RosettaCodeData/Task/Fork/NetRexx/fork.netrexx

28 lines
726 B
Plaintext

/* NetRexx */
options replace format comments java crossref symbols binary
runSample(arg)
return
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
method runSample(arg) private static
do
pb = ProcessBuilder([String ''])
env = pb.environment()
currentuser = String env.get('USER')
command = Arrays.asList([String 'ps', '-f', '-U', currentuser])
pb.command(command)
pp = pb.start()
ir = BufferedReader(InputStreamReader(pp.getInputStream()))
line = String 'Output of running' command.toString() 'is:'
loop label w_ until line = null
say line
line = ir.readLine()
end w_
catch iox = IOException
iox.printStackTrace()
end
return