(ctx context.Context, envOpts devopt.EnvOptions)
| 225 | } |
| 226 | |
| 227 | func (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 | |
| 263 | func (d *Devbox) RunScript(ctx context.Context, envOpts devopt.EnvOptions, cmdName string, cmdArgs []string) error { |
| 264 | ctx, task := trace.NewTask(ctx, "devboxRun") |
no test coverage detected