Close files upon stop. Still need to fix bash issues?
This commit is contained in:
parent
9dd37c6bc4
commit
02bc535e0e
|
@ -9,6 +9,7 @@ import (
|
||||||
func TrapSignal(cb func()) {
|
func TrapSignal(cb func()) {
|
||||||
c := make(chan os.Signal, 1)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, os.Interrupt)
|
signal.Notify(c, os.Interrupt)
|
||||||
|
signal.Notify(c, os.Kill)
|
||||||
go func() {
|
go func() {
|
||||||
for sig := range c {
|
for sig := range c {
|
||||||
fmt.Printf("captured %v, exiting...\n", sig)
|
fmt.Printf("captured %v, exiting...\n", sig)
|
||||||
|
|
|
@ -84,6 +84,7 @@ func Create(mode int, label string, execPath string, args []string, input string
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stop(proc *Process, kill bool) error {
|
func Stop(proc *Process, kill bool) error {
|
||||||
|
defer proc.OutputFile.Close()
|
||||||
if kill {
|
if kill {
|
||||||
fmt.Printf("Killing process %v\n", proc.Cmd.Process)
|
fmt.Printf("Killing process %v\n", proc.Cmd.Process)
|
||||||
return proc.Cmd.Process.Kill()
|
return proc.Cmd.Process.Kill()
|
||||||
|
|
Loading…
Reference in New Issue