Merge pull request #627 from mlaventure/fix-statedir

Ensure state dir is created before starting server
This commit is contained in:
Kenfe-Mickaël Laventure 2017-03-15 07:55:30 -07:00 committed by GitHub
commit 422e31ce90
2 changed files with 5 additions and 4 deletions

View File

@ -169,6 +169,10 @@ func main() {
}
func daemon(context *cli.Context) error {
stateDir := context.String("state-dir")
if err := os.MkdirAll(stateDir, 0755); err != nil {
return err
}
s := make(chan os.Signal, 2048)
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
// Split the listen string of the form proto://addr
@ -183,7 +187,7 @@ func daemon(context *cli.Context) error {
return err
}
sv, err := supervisor.New(
context.String("state-dir"),
stateDir,
context.String("runtime"),
context.String("shim"),
context.StringSlice("runtime-args"),

View File

@ -20,9 +20,6 @@ const (
// New returns an initialized Process supervisor.
func New(stateDir string, runtimeName, shimName string, runtimeArgs []string, timeout time.Duration, retainCount int) (*Supervisor, error) {
startTasks := make(chan *startTask, 10)
if err := os.MkdirAll(stateDir, 0755); err != nil {
return nil, err
}
machine, err := CollectMachineInformation()
if err != nil {
return nil, err