0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

Merge pull request #1211 from mholt/LogStartupCmd

Log Startup and Shutdown Commands
This commit is contained in:
Matt Holt 2016-10-24 14:26:54 -06:00 committed by GitHub
commit 561069fdb6

View file

@ -1,6 +1,7 @@
package startupshutdown
import (
"log"
"os"
"os/exec"
"strings"
@ -53,8 +54,10 @@ func registerCallback(c *caddy.Controller, registerFunc func(func() error)) erro
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if nonblock {
log.Printf("[INFO] Nonblocking Command:\"%s %s\"", command, strings.Join(args, " "))
return cmd.Start()
}
log.Printf("[INFO] Blocking Command:\"%s %s\"", command, strings.Join(args, " "))
return cmd.Run()
}