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
Doesn't Start With Fish Shell #25
Comments
Hm. Well, I explicitly ran those under the users shell to pickup things like rvm and rbenv configurations. And now I can see how that's problematic for non-bourne shells. I'd be happy to add explicit support for fish though. Could you help me write a fish version of https://github.com/puma/puma-dev/blob/master/src/puma/dev/app.go#L158-L177? Also, do you use rvm or rbenv? If so, how do you integrate them with your shell? |
Didn't think of about that. I'm running on rbenv. To integrate I'm using: # ~/.config/fish/config.fish
set PATH $HOME/.rbenv/shims $PATH
rbenv rehash For modifying the conditionals to work with fish - I think this snippet does it: if test -e ~/.powconfig
source ~/.powconfig
end
if test -e .env
source .env
end
if test -e .powrc
source .powrc
end
if test -e .powenv
source .powenv
end
if test -e Gemfile
exec bundle exec puma -C $CONFIG --tag puma-dev:%s -w $WORKERS -t 0:$THREADS -b unix:%s
end
exec puma -C $CONFIG --tag puma-dev:%s -w $WORKERS -t 0:$THREADS -b unix:%s Should the last conditional need to be wrapped in an else? That is should the bash version be modified to be the following or was that intentional: if test -e Gemfile; then
exec bundle exec puma -C $CONFIG --tag puma-dev:%s -w $WORKERS -t 0:$THREADS -b unix:%s
else
exec puma -C $CONFIG --tag puma-dev:%s -w $WORKERS -t 0:$THREADS -b unix:%s
fi What do you think the best approach is for integrating the two (and maybe more) scripts? Does it make sense to move them into separate files and then modify app.go to look something like this (excuse my syntax - never written go): shell := os.Getenv("SHELL")
switch shell {
case 'fish': path := "./execution/fish.sh"
default: path := "./execution/default.sh"
}
dat, err := ioutil.ReadFile(path)
check(err)
executionShell := string() |
I'd rather not externalize these scripts because that just becomes an installation headache. I'll go ahead and integrate your version in though. That all looks fine and the lack of else is fine because control never passes beyond the The thing I was most unsure about was if fish has |
Really, you just want to start the server under the user’s login shell so it inherits their configured environment (PATH, etc). Once you have that parent environment, you can then explicitly spawn a new launch_socket_server comes with a login_exec wrapper that runs a command under the user’s login shell. You could bundle or inline this in puma-dev’s launch plist. (Related: #13) |
I checked out your login_wrapper and puma-dev basically does that now, Loading the users shell and the execing into sh is totally doable, seems I'll make that change shortly.
|
@evanphx Thanks for the fix! |
When tailing the ~/Library/Log/puma-dev.log I see:
I'm running fish as the login shell (i.e.
chsh -s /usr/local/bin/fish
). Changing the login shell to bash fixes the problem. The offending lines appear to be the conditionals (if; fi vs. https://fishshell.com/docs/current/tutorial.html#tut_conditionals):https://github.com/puma/puma-dev/blob/master/src/puma/dev/app.go#L183-L202
I've got no experience with go - but can a shebang be added to the
exec.Command
?Alternatively - can the shell just be explicitly set to "sh" here https://github.com/puma/puma-dev/blob/master/src/puma/dev/app.go#L219?
The text was updated successfully, but these errors were encountered: