Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed May 30, 2024
1 parent d17522b commit af6af81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 2 additions & 0 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package exec

import (
"context"
"fmt"
"os"
"os/exec"
"time"
Expand All @@ -21,6 +22,7 @@ func (e *Exec) CommandContext(ctx context.Context, name string, arg ...string) *
}
cmd := commandContext(ctx, name, arg...)
cmd.Cancel = func() error {
fmt.Println("call")
return terminate(cmd, e.Signal)
}
return cmd
Expand Down
20 changes: 5 additions & 15 deletions exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ func init() {
func TestCommand(t *testing.T) {
tests := gentests(false)
for _, tt := range tests {
if err := killprocess(); err != nil {
t.Fatal(err)
}
_ = killprocess()
if checkprocess() {
t.Fatalf("%s", "the process has not exited")
}
Expand Down Expand Up @@ -89,9 +87,7 @@ func TestCommandContext(t *testing.T) {
func TestCommandContextCancel(t *testing.T) {
tests := gentests(true)
for _, tt := range tests {
if err := killprocess(); err != nil {
t.Fatal(err)
}
_ = killprocess()
if checkprocess() {
t.Fatalf("%s", "the process has not exited")
}
Expand Down Expand Up @@ -126,9 +122,7 @@ func TestCommandContextCancel(t *testing.T) {
func TestTerminateCommand(t *testing.T) {
tests := gentests(true)
for _, tt := range tests {
if err := killprocess(); err != nil {
t.Fatal(err)
}
_ = killprocess()
if checkprocess() {
t.Fatalf("%s", "the process has not exited")
}
Expand Down Expand Up @@ -169,9 +163,7 @@ func TestTerminateCommand(t *testing.T) {
func TestKillCommand(t *testing.T) {
tests := gentests(true)
for _, tt := range tests {
if err := killprocess(); err != nil {
t.Fatal(err)
}
_ = killprocess()
if checkprocess() {
t.Fatalf("%s", "the process has not exited")
}
Expand Down Expand Up @@ -206,9 +198,7 @@ func TestKillCommand(t *testing.T) {
func TestCommandCancel(t *testing.T) {
tests := gentests(true)
for _, tt := range tests {
if err := killprocess(); err != nil {
t.Fatal(err)
}
_ = killprocess()
if checkprocess() {
t.Fatalf("%s", "the process has not exited")
}
Expand Down

0 comments on commit af6af81

Please sign in to comment.