-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Signal Forwarding to Entrypoint Runner
The Entrypoint process should be notified and signals received should be propogated as necessary. This signal forwarding mimics the one in https://github.com/pablo-ruth/go-init which is an golang implementation of https://github.com/Yelp/dumb-init . The cmd.Run() has also been replaced with a cmd.Start() and cmd.Wait() to systematically start the command and Wait for it's completion without prematurely exiting.
- Loading branch information
1 parent
8bc424d
commit bd8299e
Showing
2 changed files
with
53 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
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,18 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"testing" | ||
) | ||
|
||
func TestRealRunnerSignalForwarding(t *testing.T) { | ||
rr := realRunner{} | ||
rr.signals = make(chan os.Signal, 1) | ||
rr.signals <- syscall.SIGINT | ||
if err := rr.Run("sleep", "3600"); err.Error() == "signal: interrupt" { | ||
t.Logf("SIGINT forwarded to Entrypoint") | ||
} else { | ||
t.Fatalf("Unexpected error received: %v", err) | ||
} | ||
} |