windows: Create init process with task

This prevents `task.Wait()` to return an error if it is called before the task
is started.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure
2017-10-06 13:38:08 -07:00
parent ad5266456c
commit cfa87567a0
4 changed files with 25 additions and 9 deletions

View File

@@ -304,6 +304,11 @@ func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, spec
hcsContainer: ctr,
terminateDuration: createOpts.TerminateDuration,
}
// Create the new process but don't start it
pconf := newWindowsProcessConfig(t.spec.Process, t.io)
if _, err = t.newProcess(ctx, t.id, pconf, t.io); err != nil {
return nil, err
}
r.tasks.Add(ctx, t)
var rootfs []*containerdtypes.Mount