Task

Spawn a new process which can run simultaneously with, and independently of, the original parent process.




/* 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
 