Here is a simple example of running a Muq subserver which writes a stream of text output to the current standard output. It assumes you have Perl installed on your system.
In muq/srv/
create a file write-only-1
with
contents
#!/usr/local/bin/perl select( (select(STDOUT), $| = 1)[0]); for (;;) { printf "Loop %d\n", $loop++; sleep 10; }
At the unix level, do chmod +x write-only-1
to make the script executable.
Now, at the Muq prompt do:
root: makeSocket --> s @$s.standardOutput --> s$s.standardOutput root: [ :socket s :commandline "write-only-1|" | ]rootPopenSocket root:
You will see a sequence of lines
Loop 0 Loop 1 ...
printing out, one every ten seconds. These are being copied directly from the socket into the output stream for the current job, so they will not interfere with anything else you might wish to do.
You may close down the subprocess by doing
root: [ :socket s | ]closeSocket root:
Go to the first, previous, next, last section, table of contents.