Skip to content

Commit

Permalink
wtf!
Browse files Browse the repository at this point in the history
  • Loading branch information
tamird committed Oct 18, 2024
1 parent bd3221d commit 0ec9634
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ func run() error {

cmd := exec.CommandContext(ctx, "cargo", "xtask", "run")
cmd.Dir = projectDir
prevCancel := cmd.Cancel
cmd.Cancel = func() error {
fmt.Println("!!! Canceling")
return prevCancel()
}

stdoutPipe, err := cmd.StdoutPipe()
if err != nil {
Expand Down Expand Up @@ -200,9 +205,12 @@ func run() error {
panic(err)
}
if strings.Contains(text, "Waiting for Ctrl-C") {
fmt.Println("!!! Sending interrupt")
if err := cmd.Process.Signal(os.Interrupt); err != nil {
panic(err)
}
} else {
fmt.Println("!!! Not sending interrupt")
}
}
if err := scanner.Err(); err != nil {
Expand Down

0 comments on commit 0ec9634

Please sign in to comment.