Add pledge(2) support (OpenBSD only) via a 'protector' package. (#1297)

pull/1832/head
Aaron Bieber 4 years ago committed by Junegunn Choi
parent 7771241cc0
commit a1bcdc225e

@ -1,9 +1,13 @@
package main
import "github.com/junegunn/fzf/src"
import (
"github.com/junegunn/fzf/src"
"github.com/junegunn/fzf/src/protector"
)
var revision string
func main() {
protector.Protect()
fzf.Run(fzf.ParseOptions(), revision)
}

@ -0,0 +1,8 @@
// +build !openbsd
package protector
// Protect calls OS specific protections like pledge on OpenBSD
func Protect() {
return
}

@ -0,0 +1,10 @@
// +build openbsd
package protector
import "golang.org/x/sys/unix"
// Protect calls OS specific protections like pledge on OpenBSD
func Protect() {
unix.PledgePromises("stdio rpath tty proc exec")
}
Loading…
Cancel
Save