Runtime.getRuntime().exec

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Runtime.getRuntime().exec

gpatrick
$ cat inst.nrx
system = String 'hostA'
p = Runtime.getRuntime().exec("pmrun -h "system" root")

$ nrc inst.nrx
NetRexx portable processor 3.04 NetRexx '3.04', build 1-20150504-0639
Copyright (c) RexxLA, 2011,2014.   All rights reserved.
Parts Copyright (c) IBM Corporation, 1995,2008.
Program inst.nrx
 2 +++ p = Runtime.getRuntime().exec("pmrun -h "system" root")
   +++ ^
   +++ Warning: Variable is set but not used
Compilation of 'inst.nrx' successful [one warning]

$ java inst
$

However, if I replace pmrun in the .exec with ssh, it will exec the ssh.  Any idea why it won't run?
Reply | Threaded
Open this post in threaded view
|

Re: Runtime.getRuntime().exec

gpatrick
I used this:

import java.io.
system = String 'hostA'
r = Runtime.getRuntime()
p = r.exec("pmrun -h "system" root ls /tmp")
p.waitFor()
b = BufferedReader(InputStreamReader(p.getInputStream()))
line = String "";
loop forever
  line = b.readLine()
  if line = null then leave
  say line
end
b.close()