-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[script-on-error] disable for fish shell, and add testscript unit-test #1488
Conversation
Current dependencies on/for this PR: This comment was auto-generated by Graphite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, do we run scripts in the shell of choice? I thought we always used bash for portability. (Though looking at code it looks like we use sh
or /bin/sh
)
Fish in general is not a scripting language and more designed to be interactive only. (At least acording to Mr. Ridiculous Fish in this answer
Would this not break portability? At least with bash we know it will be installed. That's why plugins look for bash.
@@ -25,6 +25,7 @@ type devboxer interface { | |||
Lockfile() *lock.File | |||
AllInstallablePackages() ([]*devpkg.Package, error) | |||
InstallablePackages() []*devpkg.Package | |||
IsUserShellFish() (bool, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really introduced in this PR, but I think we should cut down on this interface pattern for pure data like this. (I admin to be much to blame for this)
There are some cases where the circular dependency is hard to avoid (for example if you need to call a function with side-effects that would create a cycle). If what you are passing in is pure data, cheap to compute (like in this case), then using a struct argument keeps code simpler and more linear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree 💯
In this particular package, there are more public APIs than I think are good. For example, WriteScriptToFile
should likely not be a public method. Having a tighter public interface, would enable a constructor which can take some of these arguments (as you suggest), minimizing the need for the interface.
Approving, but added comments for discussion. |
@mikeland73 good point. The init-hooks will run in I added a comment in code to clarify this, and also showed more output in the Test Plan. |
Summary
set -e
can fail in fish-shells (sometimes), so we disable script-on-error for them.I also add a testscript unit-test for script-exit-on-error, in general.
How was it tested?
I run fish-shell, and did a sanity test that the
go/hello-world
example passesrun_test
.BEFORE:
with this devbox.json
doing
devbox shell
would give:AFTER: