-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df82d57
commit 179fec9
Showing
4 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package cli | ||
|
||
import "syscall" | ||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func setSysProcAttr(attr *syscall.SysProcAttr) { | ||
attr.Setpgid = true | ||
} | ||
|
||
func killProcess(process *os.Process, signal os.Signal) { | ||
// Sending the signal to -pid sends it to all processes | ||
// in the process group. | ||
syscall.Kill(-process.Pid, signal.(syscall.Signal)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,17 @@ | ||
package cli | ||
|
||
import "syscall" | ||
import ( | ||
"os" | ||
"syscall" | ||
) | ||
|
||
func setSysProcAttr(attr *syscall.SysProcAttr) { | ||
attr.Setpgid = true | ||
attr.Pdeathsig = syscall.SIGTERM | ||
} | ||
|
||
func killProcess(process *os.Process, signal os.Signal) { | ||
// Sending the signal to -pid sends it to all processes | ||
// in the process group. | ||
syscall.Kill(-process.Pid, signal.(syscall.Signal)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cli | ||
|
||
import "os" | ||
|
||
func killProcess(process *os.Process, _ os.Signal) { | ||
process.Kill() | ||
} |