mirror of
https://github.com/caddyserver/xcaddy.git
synced 2024-11-09 10:50:06 +00: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"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/caddyserver/xcaddy"
|
"github.com/caddyserver/xcaddy"
|
||||||
)
|
)
|
||||||
|
@ -203,17 +202,11 @@ func runDev(ctx context.Context, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
cleanup := func() {
|
|
||||||
err = os.Remove(binOutput)
|
err = os.Remove(binOutput)
|
||||||
if err != nil && !os.IsNotExist(err) {
|
if err != nil && !os.IsNotExist(err) {
|
||||||
log.Printf("[ERROR] Deleting temporary binary %s: %v", binOutput, err)
|
log.Printf("[ERROR] Deleting temporary binary %s: %v", binOutput, err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
defer cleanup()
|
|
||||||
go func() {
|
|
||||||
time.Sleep(5 * time.Second)
|
|
||||||
cleanup()
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return cmd.Wait()
|
return cmd.Wait()
|
||||||
|
|
Loading…
Reference in a new issue