forked from containers/skopeo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add new "procutils" that exposes PDEATHSIG
To fix compilation on MacOS. I think actually we want to use this pervasively in our tests on Linux; it doesn't really matter when run inside a transient container, but `PDEATHSIG` is useful for persistent containers (e.g.) toolbox and when running outside of a pid namespace, e.g. on a host system shell directly or in systemd. Signed-off-by: Colin Walters <[email protected]>
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build !linux | ||
// +build !linux | ||
|
||
package main | ||
|
||
import ( | ||
"os/exec" | ||
) | ||
|
||
// cmdLifecycleToParentIfPossible tries to exit if the parent process exits (only works on Linux) | ||
func cmdLifecycleToParentIfPossible(c *exec.Cmd) { | ||
} |
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,14 @@ | ||
package main | ||
|
||
import ( | ||
"os/exec" | ||
"syscall" | ||
) | ||
|
||
// cmdLifecyleToParentIfPossible is a thin wrapper around prctl(PR_SET_PDEATHSIG) | ||
// on Linux. | ||
func cmdLifecycleToParentIfPossible(c *exec.Cmd) { | ||
c.SysProcAttr = &syscall.SysProcAttr{ | ||
Pdeathsig: syscall.SIGTERM, | ||
} | ||
} |
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