proc object proc
Documentation for proc object
proc assembled from the following types:
shell return a Proc object, which can be used to communicate with the process in more detail. Please note that unless you close all output pipes, the program will usually not terminate.
my = run 'git', 'log', '--oneline', :out;for .out.lines ->.out.close();
If the program fails (exits with a non-zero exit code), it will throw an exception when the returned Proc object is sunk. You can save it into a variable, even anonymous one, to prevent the sinking:
$ = run '/bin/false'; # does not sink the Proc and so does not throw
You can tell the
Proc object to capture output as a filehandle by passing the
:err flags. You may also pass input via the
my = run 'echo', 'Hello, world', :out;my = run 'cat', '-n', :in(.out), :out;say .out.get;.out.close();
You may also use
Proc to capture the PID, send signals to the application, and check the exitcode.
my = run 'crontab', '-l';if .exitcode == 0else