MCPcopy Index your code
hub / github.com/jetify-com/devbox / Shell

Method Shell

internal/devbox/devbox.go:227–261  ·  view source on GitHub ↗
(ctx context.Context, envOpts devopt.EnvOptions)

Source from the content-addressed store, hash-verified

225}
226
227func (d *Devbox) Shell(ctx context.Context, envOpts devopt.EnvOptions) error {
228 ctx, task := trace.NewTask(ctx, "devboxShell")
229 defer task.End()
230
231 envs, err := d.ensureStateIsUpToDateAndComputeEnv(ctx, envOpts)
232 if err != nil {
233 return err
234 }
235
236 fmt.Fprintln(d.stderr, "Starting a devbox shell...")
237
238 // Used to determine whether we're inside a shell (e.g. to prevent shell inception)
239 // TODO: This is likely obsolete but we need to decide what happens when
240 // the user does shell-ception. One option is to leave the current shell and
241 // join a new one (that way they are not in nested shells.)
242 envs[envir.DevboxShellEnabled] = "1"
243
244 if err = createDevboxSymlink(d); err != nil {
245 return err
246 }
247
248 opts := []ShellOption{
249 WithHistoryFile(filepath.Join(d.projectDir, shellHistoryFile)),
250 WithProjectDir(d.projectDir),
251 WithEnvVariables(envs),
252 WithShellStartTime(telemetry.ShellStart()),
253 }
254
255 shell, err := d.newShell(envOpts, opts...)
256 if err != nil {
257 return err
258 }
259
260 return shell.Run()
261}
262
263func (d *Devbox) RunScript(ctx context.Context, envOpts devopt.EnvOptions, cmdName string, cmdArgs []string) error {
264 ctx, task := trace.NewTask(ctx, "devboxRun")

Callers 1

runShellCmdFunction · 0.80

Calls 10

newShellMethod · 0.95
ShellStartFunction · 0.92
createDevboxSymlinkFunction · 0.85
WithHistoryFileFunction · 0.85
WithProjectDirFunction · 0.85
WithEnvVariablesFunction · 0.85
WithShellStartTimeFunction · 0.85
EndMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected