MCPcopy
hub / github.com/containers/toolbox / rootRunImpl

Function rootRunImpl

src/cmd/rootMigrationPath.go:45–76  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

43}
44
45func rootRunImpl(cmd *cobra.Command, args []string) error {
46 if len(args) != 0 {
47 panic("unexpected argument: commands known or unknown shouldn't reach here")
48 }
49
50 if utils.IsInsideContainer() {
51 if !utils.IsInsideToolboxContainer() {
52 return errors.New("this is not a Toolbx container")
53 }
54
55 exitCode, err := utils.ForwardToHost()
56 return &exitError{exitCode, err}
57 }
58
59 container, image, release, err := resolveContainerAndImageNames("", "", "", "", "")
60 if err != nil {
61 return err
62 }
63
64 userShell := os.Getenv("SHELL")
65 if userShell == "" {
66 return errors.New("failed to get the current user's default shell")
67 }
68
69 command := []string{userShell, "-l"}
70
71 if err := runCommand(container, true, image, release, 0, command, true, true, false); err != nil {
72 return err
73 }
74
75 return nil
76}

Callers

nothing calls this directly

Calls 2

runCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…