Skip to content

Commit

Permalink
Avoid leaving cloudflared orphan process (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmiranda authored Nov 29, 2021
1 parent 014e7b5 commit 3503c19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cfdtunnel/cfdtunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ func commandKill(cmd *exec.Cmd) {
func (args Arguments) runSubCommand() {
log.Debugf("Running subcommand: %v", args.Command)
if !checkSubCommandExists(args.Command) {
os.Exit(1)
return
}

output, err := exec.Command(args.Command, args.Args...).CombinedOutput()

fmt.Println(string(output))

if err != nil {
log.Fatalf("An error occurred trying to run the command %v: %v", args.Command, err)
log.Errorf("An error occurred trying to run the command %v: %v", args.Command, err)
}

}
Expand Down
4 changes: 2 additions & 2 deletions cfdtunnel/cfdtunnel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ func TestRunSubCommandMissing(t *testing.T) {

// Cast the error as *exec.ExitError and compare the result
e, ok := err.(*exec.ExitError)
assert.True(t, ok)
assert.Equal(t, "exit status 1", e.Error())
assert.False(t, ok)
assert.Nil(t, e)

}

Expand Down

0 comments on commit 3503c19

Please sign in to comment.