mirror of
https://github.com/caddyserver/xcaddy.git
synced 2025-02-02 06:07:24 +01:00
Only cleanup temporary file after run is over
Mac apparently sends SIGKILL to processes spawned by a process that no longer exists on disk! ... or something like that.
This commit is contained in:
parent
7e4f9a06d3
commit
68d27a0401
1 changed files with 1 additions and 8 deletions
|
@ -24,7 +24,6 @@ import (
|
|||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/caddyserver/xcaddy"
|
||||
)
|
||||
|
@ -203,17 +202,11 @@ func runDev(ctx context.Context, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cleanup := func() {
|
||||
defer func() {
|
||||
err = os.Remove(binOutput)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
log.Printf("[ERROR] Deleting temporary binary %s: %v", binOutput, err)
|
||||
}
|
||||
}
|
||||
defer cleanup()
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
cleanup()
|
||||
}()
|
||||
|
||||
return cmd.Wait()
|
||||
|
|
Loading…
Reference in a new issue