proc::async object async
Documentation for proc::async object async, assembled from the following types:
When you need more control over the communication with and from another process, you will want to make use of Proc::Async. This class provides support for asynchronous communication with a program, as well as the ability to send signals to that program.
# Get ready to run the programmy = Proc::Async.new('tail', '-f', '/var/log/system.log');.stdout.tap(-> );.stderr.tap(-> );# Start the programmy = .start;sleep 10;# Tell the program to stop.kill('QUIT');# Wait for the program to finishawait ;
Here is a small program that uses the "tail" program to print out the contents of the log named
system.log for 10 seconds and then tells the program to stop with a QUIT signal.
Proc provides access to output using
Proc::Async provides access using asynchronous supplies (see Supply).
If you want to run a program and do some work while you wait for the original program to finish, the
start routine returns a Promise, which is kept when the program quits.
write method to pass data into the program.