Process type
Methods
- .(p:Process, field:Str) Source: stdlib.ngs:4463
Get process "stdout" Parameters
field "stdout" Returns
Str
- .(p:Process, field:Str) Source: stdlib.ngs:4479
Get process "stderr" Parameters
field "stderr" Returns
Str
- .=(p:Process, field:Str, v:Any) Source: stdlib.ngs:4471
Set process "stdout" Parameters
field "stdout" Returns
Unspecified, do not count on this value
- .=(p:Process, field:Str, v:Any) Source: stdlib.ngs:4487
Set process "stderr" Parameters
field "stderr" Returns
Unspecified, do not count on this value
- ExitCode(p:Process) Source: stdlib.ngs:4596
Convert Process to exit code. Waits for the process to finish and uses its exit code.
- finished_ok(p:Process) Source: stdlib.ngs:4494
Decide whether process finished normally: exit code must be 0. Parameters
p any process Returns
bool
- finished_ok(p:Process) Source: stdlib.ngs:4500
Decide whether /bin/false process finished normally: exit code must be 1. Parameters
p /bin/false process Returns
bool
- finished_ok(p:Process) Source: stdlib.ngs:4510
Decide whether specific process finished normally: exit code must be 0 or 1. Parameters
p One of the processes: /usr/bin/test, {,/usr}/bin/fuser, {,/usr}/bin/ping Returns
boolExample
# Exit code 1 on the line below but no exception thanks to this finished_ok(). if $(test -f /) echo("/ is a file") # Outputs nothing, / is a directory
- finished_ok(p:Process) Source: stdlib.ngs:4517
Decide whether a process finished normally: OK for any process that has "nofail:" option Example
$(nofail: ls no-such-file)
- finished_ok(p:Process) Source: stdlib.ngs:4527
Decide whether a process finished normally: OK for exit codes given in "ok:" option Example
$(ok:2 ls no-such-file) $(ok:[0,1,2] ls no-such-file) $(ok:0..10 ls no-such-file) $(ok:10 ls no-such-file) # ProcessFail exception
- init(p:Process, c:Command) Source: stdlib.ngs:4545
Process constructor. Initializes fields.
- inspect(p:Process) Source: stdlib.ngs:5682
Inspect Process Returns
Arr of Str
- kill(p:Process, sig:Int=15) Source: stdlib.ngs:4977
Send signal to a Process. Uses KILL(2). Throws InvalidArgument if Process does not have "pid". Throws KillFail on error. Parameters
sig Signal to send. Defaults to SIGNALS.TERM Returns
unspecified at this time, do not count on it
- lines(p:Process) Source: stdlib.ngs:5046
Wait for the process and return lines of its stdout. Returns
Arr of StrExample
$(seq 10 2 20).lines().map(Int) # [10,12,14,16,18,20]
- lines(p:Process, cb:Fun) Source: stdlib.ngs:5054
Iterate lines of Process' stdout, calling cb with successive lines. Warning: current implementation waits for the process to finish, accumulates all its stdout, and only then starts calling cb for each line.
- Str(p:Process) Source: stdlib.ngs:4607
Wait for the process to finish and return its standard output. Returns
Str
- wait(p:Process) Source: stdlib.ngs:4569
Wait for a process. Waits for reading and writing threads to finish. Waits for the process to finish. Checks whether to throw ProcessFail using finished_ok(). Returns
p