Skip to content

Commit 46f8411

Browse files
authored
Remove more dead code (#735)
## Summary TSIA ## How was it tested? CICD
1 parent f7c249e commit 46f8411

File tree

3 files changed

+1
-59
lines changed

3 files changed

+1
-59
lines changed

internal/impl/shell.go

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/alessio/shellescape"
1919
"github.com/pkg/errors"
2020
"go.jetpack.io/devbox/internal/boxcli/featureflag"
21-
"go.jetpack.io/devbox/internal/boxcli/usererr"
2221
"go.jetpack.io/devbox/internal/debug"
2322
"go.jetpack.io/devbox/internal/nix"
2423
"go.jetpack.io/devbox/internal/planner/plansdk"
@@ -64,9 +63,6 @@ type DevboxShell struct {
6463
// UserInitHook contains commands that will run at shell startup.
6564
UserInitHook string
6665

67-
ScriptName string
68-
ScriptCommand string
69-
7066
// profileDir is the absolute path to the directory storing the nix-profile
7167
profileDir string
7268
historyFile string
@@ -289,17 +285,10 @@ func (s *DevboxShell) Run() error {
289285
// This could be from one of the generated shellrc commands, but more likely is from
290286
// a user's command or script. So, we want to return nil for this.
291287
if exitErr := (&exec.ExitError{}); errors.As(err, &exitErr) {
292-
293-
// The exception to the previous comment is if we are executing a shell script
294-
// via `devbox run` or the deprecated `devbox shell -- <command>`. In this case,
295-
// we do want to return the exit code of the script that was run.
296-
if s.ScriptCommand != "" {
297-
return usererr.NewExecError(err)
298-
}
299288
return nil
300289
}
301290

302-
// This means that there was a error from devbox's code or nix's code. Not a user
291+
// This means that there was an error from devbox's code or nix's code. Not a user
303292
// error and so we do return it.
304293
return errors.WithStack(err)
305294
}
@@ -354,11 +343,6 @@ func (s *DevboxShell) writeDevboxShellrc() (path string, err error) {
354343
}
355344
}()
356345

357-
pathPrepend := s.profileDir + "/bin"
358-
if s.pkgConfigDir != "" {
359-
pathPrepend = s.pkgConfigDir + ":" + pathPrepend
360-
}
361-
362346
tmpl := shellrcTmpl
363347
if s.name == shFish {
364348
tmpl = fishrcTmpl
@@ -370,8 +354,6 @@ func (s *DevboxShell) writeDevboxShellrc() (path string, err error) {
370354
OriginalInitPath string
371355
UserHook string
372356
PluginInitHook string
373-
PathPrepend string
374-
ScriptCommand string
375357
ShellStartTime string
376358
HistoryFile string
377359
ExportEnv string
@@ -381,8 +363,6 @@ func (s *DevboxShell) writeDevboxShellrc() (path string, err error) {
381363
OriginalInitPath: s.userShellrcPath,
382364
UserHook: strings.TrimSpace(s.UserInitHook),
383365
PluginInitHook: strings.TrimSpace(s.pluginInitHook),
384-
PathPrepend: pathPrepend,
385-
ScriptCommand: strings.TrimSpace(s.ScriptCommand),
386366
ShellStartTime: s.shellStartTime,
387367
HistoryFile: strings.TrimSpace(s.historyFile),
388368
ExportEnv: exportify(s.env),

internal/impl/shellrc.tmpl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ content readable.
2727

2828
{{ with .ExportEnv -}}
2929
{{ . }}
30-
{{- else -}}
31-
PATH="{{ .PathPrepend }}:$PATH"
3230
{{- end }}
3331

3432
{{- /*
@@ -79,20 +77,3 @@ cd "$working_dir" || exit
7977
# log that the shell is interactive now!
8078
devbox log shell-interactive {{ .ShellStartTime }}
8179
{{ end }}
82-
83-
{{- if .ScriptCommand }}
84-
85-
# Begin Script Command
86-
87-
run_script() {
88-
working_dir="$(pwd)"
89-
cd "{{ .ProjectDir }}" || exit
90-
91-
{{ .ScriptCommand }}
92-
93-
cd "$working_dir" || exit
94-
}
95-
96-
# End Script Command
97-
98-
{{- end }}

internal/impl/shellrc_fish.tmpl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ makes fish do exactly what we want and behave in the same way as other shells.
2727
*/ -}}
2828
{{ with .ExportEnv }}
2929
{{ . }}
30-
{{- else }}
31-
export PATH="{{ .PathPrepend }}:$PATH"
3230
{{- end }}
3331

3432
{{- /*
@@ -83,20 +81,3 @@ cd "$workingDir" || exit
8381
# log that the shell is interactive now!
8482
devbox log shell-interactive {{ .ShellStartTime }}
8583
{{ end }}
86-
87-
# Begin Script command
88-
89-
{{- if .ScriptCommand }}
90-
91-
function run_script
92-
set workingDir "$(pwd)"
93-
cd "{{ .ProjectDir }}" || exit
94-
95-
{{ .ScriptCommand }}
96-
97-
cd "$workingDir" || exit
98-
end
99-
100-
# End Script command
101-
102-
{{- end }}

0 commit comments

Comments
 (0)