Adding in SendSignal example.
diff --git a/expect_test.go b/expect_test.go index acacc89..b9d0a51 100644 --- a/expect_test.go +++ b/expect_test.go
@@ -1329,7 +1329,7 @@ return } - reExpect, err := regexp.Compile("Sig USR1") + reExpect, err := regexp.Compile("USR1") if err != nil { fmt.Printf("regexp.Compile(%q) failed: %v", "Sig USR1", err) return @@ -1342,7 +1342,7 @@ } fmt.Println(match) <-r - // Output: Sig USR1 + // Output: Got the USR1 Signal } var tMap map[string][]Batcher
diff --git a/testdata/traptest.sh b/testdata/traptest.sh index f5a634a..8e56ebf 100755 --- a/testdata/traptest.sh +++ b/testdata/traptest.sh
@@ -1,13 +1,16 @@ #!/bin/bash -FIFOFILE=~/fifo +FIFOFILE=$(mktemp -u) trap 'rm -f $FIFOFILE; echo "Got the INTR Signal"' INT trap 'rm -f $FIFOFILE; echo "Got the QUIT Signal"' QUIT trap 'rm -f $FIFOFILE; echo "Got the USR1 Signal"' USR1 trap 'rm -f $FIFOFILE; echo "Got the HUP Signal"' HUP -[[ -f "$FIFOFILE" ]] && rm -f $FIFOFILE +if [[ -p $FIFOFILE ]] +then + rm -f $FIFOFILE +fi -mkfifo -m 0400 $FIFOFILE || exit +mkfifo -m 0400 $FIFOFILE echo "Waiting for signal" -cat < $FIFOFILE || echo "" +true < $FIFOFILE sleep 10