diff --git a/src/cmd/create.go b/src/cmd/create.go index 8571d55ce..c7436fe6d 100644 --- a/src/cmd/create.go +++ b/src/cmd/create.go @@ -203,6 +203,17 @@ func createContainer(container, image, release string, showCommandToEnter bool) return err } + s := spinner.New(spinner.CharSets[9], 500*time.Millisecond) + + stdoutFd := os.Stdout.Fd() + stdoutFdInt := int(stdoutFd) + if logLevel := logrus.GetLevel(); logLevel < logrus.DebugLevel && terminal.IsTerminal(stdoutFdInt) { + s.Prefix = fmt.Sprintf("Creating container %s: ", container) + s.Writer = os.Stdout + s.Start() + defer s.Stop() + } + toolboxPath := os.Getenv("TOOLBOX_PATH") toolboxPathEnvArg := "TOOLBOX_PATH=" + toolboxPath toolboxPathMountArg := toolboxPath + ":/usr/bin/toolbox:ro" @@ -458,23 +469,10 @@ func createContainer(container, image, release string, showCommandToEnter bool) logrus.Debugf("%s", arg) } - s := spinner.New(spinner.CharSets[9], 500*time.Millisecond) - - stdoutFd := os.Stdout.Fd() - stdoutFdInt := int(stdoutFd) - if logLevel := logrus.GetLevel(); logLevel < logrus.DebugLevel && terminal.IsTerminal(stdoutFdInt) { - s.Prefix = fmt.Sprintf("Creating container %s: ", container) - s.Writer = os.Stdout - s.Start() - defer s.Stop() - } - if err := shell.Run("podman", nil, nil, nil, createArgs...); err != nil { return fmt.Errorf("failed to create container %s", container) } - s.Stop() - if showCommandToEnter { fmt.Printf("Created container: %s\n", container) fmt.Printf("Enter with: %s\n", enterCommand)