sauce icon indicating copy to clipboard operation
sauce copied to clipboard

Subprocess mode

Open DanCardin opened this issue 5 years ago • 0 comments

This would enable one to simply kill the current shell to revert state.

Due to lack of any (or at least consistent) support for running shell code on startup of a shell (without screwing with the normal (bashrc, etc) loading sequence, this will likely have to rely on an environment variable.

Potential sequence of events:

  • start subprocess with SAUCE_SUBPROCESS=1 env var (automatically +1 from previous/missing value)
  • normal sauce shell init bashrc/zshrc/etc loading behavior should cause sauce to be invoked.
  • sauce shell init inspects that env var and automatically emits the autoload-hook shell stuff and force-overrides the autoload flag (once)
  • that, in turn, causes sauce to execute once, on shell startup

In this way, sauce shell can essentially just start a subprocess in a particular way and the rest should "just work"

sauce config subshell=false/true (default false)

Given subshell=true, sauce shell init would emit a --subprocess flag into the shell invocation (to avoid forcing loading config on a vanilla sauce command.

--subprocess flag would then cause sauce to create a subprocess into the above subprocess workflow would execute.

DanCardin avatar Feb 15 '21 16:02 DanCardin