You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gosuv/vendor/github.com/codeskyblue/kexec
codeskyblue 5cde531d83
change godep to glide
7 years ago
..
examples change godep to glide 7 years ago
tests change godep to glide 7 years ago
.gitignore add vendor 8 years ago
LICENSE log is ok to see in the web 8 years ago
README.md add SetUser support 8 years ago
kexec.go add SetUser support 8 years ago
kexec_posix.go add SetUser support 8 years ago
kexec_test.go change godep to glide 7 years ago
kexec_windows.go add SetUser support 8 years ago

README.md

kexec

GoDoc

This is a golang lib, add a Terminate command to exec.

Tested on windows, linux, darwin.

This lib has been used in fswatch.

Usage

go get -v github.com/codeskyblue/kexec

example1:

package main

import "github.com/codeskyblue/kexec"

func main(){
	p := kexec.Command("python", "flask_main.py")
	p.Start()
	p.Terminate(syscall.SIGINT)
}

example2: see more examples

package main

import (
	"github.com/codeskyblue/kexec"
)

func main() {
	// In unix will call: bash -c "python flask_main.py"
	// In windows will call: cmd /c "python flask_main.py"
	p := kexec.CommandString("python flask_main.py")
	p.Stdout = os.Stdout
	p.Stderr = os.Stderr
	p.Start()
	p.Terminate(syscall.SIGKILL)
}

example3:

package main

import "github.com/codeskyblue/kexec"

func main() {
	p := kexec.Command("whoami")
	p.SetUser("codeskyblue") // Only works on darwin and linux
	p.Run()
}

PS

This lib also support you call Wait() twice, which is not support by os/exec

LICENSE

MIT