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
run_custom_command: allow using interactive shell on unix #383
Conversation
The question is if we want to have that as an option in the argument string or create a new option which can be set to true or false. And if we add the option to source a .bashrc/.zshrc file before executing a command. |
The benefit of having it as part of the argument string is that it can be toggled on a per-command basis. Otherwise, someone will inevitably run into the same problems with some other custom command |
Lgtm, but could you write a text into the readme that's explains that this feature exists and how it works. |
Is there an existing section on custom commands where I can add it? |
I would just add a little text like: For running commands in an interactive shell, for example to source your shells rc file, you can ads -i in front of your custom command. But note that this requires the command to exit the shell correctly or else the shell will hang indefinitely. |
why not use "custom command" = "bash -i -c 'foo bar'" for running a command with interactive shell? Why is there an extra option or something else necessary if it is already possible to do it? |
@utkarshgupta137 How can I test this? Where can I find the binaries? |
|
You can clone my fork & then run |
"custom command" = "$SHELL -i -c 'foo bar'" should also use the default shell or you can explicitly use another shell, e.g. zsh or fish or bash installed in another path for a single command.
For a normal command I would not want to depend on some shell functions or aliases. For non-interactive shells you maybe want the shell to startup fast and do not load something like a complicated prompt that shows git status, current time, weater, ... I also do not know, if all shells support aliases/function. But for me it is ok, as long as it is possible to not run interactive shells for custom commands. |
@reini-1 by default if you just specify a command it doesn't load any aliases and functions. Those are only loaded when the shell is run interactively. |
@utkarshgupta137 @DottoDev, I just tried this and I can confirm that
In my opinion, I think that we should just stick to non-interactive mode and if users want to use their own aliases/functions, instruct them to source the script containing those aliases (this is what I do now).
|
I mean sourcing it is always an option but I still like the idea of running it interactive if somebody needs it for anything. |
Conceptually, I agree that an interactive shell shouldn't be used by an automated tool. |
Well I guess go for this then😉 We are in a better situation now that it is behind the |
This will be merged till a better option will maybe be available |
Standards checklist:
cargo build
)cargo fmt
)cargo clippy
)cargo test
)This allows loading environment & aliases from the user's rc files.
@reini-1 @ealap Please test once for any regressions.