jolly-midnight-72759
10/07/2020, 2:29 AMProcess
and not InteractiveProcess
?hundreds-father-404
10/07/2020, 3:07 AMjolly-midnight-72759
10/07/2020, 1:30 PMProcess
would be used to run the bash executable. But in pants-plugins/examples/bash/bash_setup.py
I see that is not the case. Instead the BinaryPaths
, BinaryPathRequest
and BashProgram
are all that is required to execute the bash repl.
Does exe: str
tell the Rust engine to "execute the binary passed to this class? In this case bash_program_paths.first_path.path
.hundreds-father-404
10/07/2020, 3:52 PMIsn’t a REPL always interactive?Indeed. But Jupyter is interesting because you’re not necessarily typing into the console like a normal REPL. I think you would still use
InteractiveProcess
, though, so that you have in the foreground its message about starting up and where to open the page.
—
Ah, I can see how that’s confusing. bash_setup.py
only exists for utils used by the other rules. Under-the-hood, the rule for BinaryPathRequest -> BinaryPaths
is running a Process
to discover where on your machine the program is installed. This path is getting stored as BashProgram.exe
, which is solely a string representing the absolute path to, say, /bin/bash
. Then, you can use that in your other processes to set argv to be [/bin/bash, my_script.sh]
, for example. Rather than hardcoding /bin/bash
, BinaryPaths
is finding `bash`’s absolute path for you.
—
In repl.py
, you’re not seeing InteractiveProcess
or Process
anywhere because that gets handled by core/goals/repl.py
. All your plugin does is give information needed by core/goals/repl.py
to set up that InteractiveProcess
.
If you were to do your own new jupyter
goal—rather than hooking into `repl`—then you would end up using InteractiveProcess
.