Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions start.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ func init() {
}

func startContainer(context *cli.Context, spec *specs.LinuxSpec, rspec *specs.LinuxRuntimeSpec) (int, error) {
config, err := createLibcontainerConfig(context.GlobalString("id"), spec, rspec)
containerID := context.GlobalString("id")
config, err := createLibcontainerConfig(containerID, spec, rspec)
if err != nil {
return -1, err
}
Expand All @@ -94,7 +95,7 @@ func startContainer(context *cli.Context, spec *specs.LinuxSpec, rspec *specs.Li
if err != nil {
return -1, err
}
container, err := factory.Create(context.GlobalString("id"), config)
container, err := factory.Create(containerID, config)
if err != nil {
return -1, err
}
Expand Down Expand Up @@ -124,6 +125,7 @@ func startContainer(context *cli.Context, spec *specs.LinuxSpec, rspec *specs.Li
if err := container.Start(process); err != nil {
return -1, err
}
output(containerID)
return handler.forward(process)
}

Expand Down
5 changes: 5 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ func fatal(err error) {
os.Exit(1)
}

// output prints string to stdout.
func output(str string) {
fmt.Fprintln(os.Stdout, str)
}

// getDefaultID returns a string to be used as the container id based on the
// current working directory of the runc process. This function panics
// if the cwd is unable to be found based on a system error.
Expand Down