pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

pipeline ignores shell initialization routines

Open yunake opened this issue 5 years ago • 4 comments

Things like custom aliases and functions are not available in the pipeline.

This is what is problematic with current approach of hardcoding /bin/sh instead of using current shell. Not sure if the real shell can be used instead?

yunake avatar Jan 10 '20 01:01 yunake

Agreed that'd be a nice addition. Most common shells support the -c option that we need, so it should be possible to use the user's configured shell most of the time I think. We'd probably want to whitelist which shells we know that works with.

I think we'd have to make them login shells too in order to load user aliases/functions -- bash has the -l option for that, I think most other shells do too. I'm not aware of any poblems with that, other than it just taking longer for the shell to load up on each execution, but I'd have to test it a bit.

Tab completion wouldn't work with the custom aliases and functions, I think we're kind of stuck there with the current implementation.

codekitchen avatar Jan 10 '20 15:01 codekitchen

I had a use-case for using a zsh feature today so I implemented using the shell specified in $SHELL instead of always /bin/sh. I haven't enabled login shell yet though, I still need to figure out how well that'll work, so I don't think custom functions and aliases will get read from config yet.

codekitchen avatar Dec 03 '20 00:12 codekitchen

Whoops, I meant "interactive shell" everywhere that I said "login shell" above. I've tested using an interactive shell in bash, zsh and fish and everything seems to work well. So this will now allow using custom aliases and functions etc, though as I mentioned above it won't autocomplete them -- I really don't know how we could make that work without integrating pipeline directly into the shell itself (which I would love to see happen someday).

codekitchen avatar Dec 07 '20 03:12 codekitchen

I celebrated too soon -- with further usage I'm seeing an intermittent issue with interactive shells and zsh (haven't tested other shells yet). Sometimes, but not always, it prints zsh: suspended (tty input) and then exits the pipeline process. I'm not sure why this is happening yet, but I'm going to back out this change for now.

codekitchen avatar Dec 07 '20 21:12 codekitchen