This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: 2 things
- To: Simon Gornall <simon@unique-id.com>
- Subject: Re: 2 things
- From: Bryce McKinlay <bryce@albatross.co.nz>
- Date: Tue, 03 Aug 1999 12:02:53 +1200
- CC: java discuss <java-discuss@sourceware.cygnus.com>
- References: <37A58C2A.240DE04B@unique-id.com>
Simon Gornall wrote:
> Also, here's a (very poor!) patch for Runtime.exec() which takes into
> account a single level of quoting in a passed-in execution string. So
> you can call exec("find /tmp -name xxx -printf '%p %AH'") for example.
This is not neccessary. The right way to go in Java would be something like:
String[] pargs = {"find","/tmp","-name","xxx","-printf","%p %AH"};
Process p = Runtime.getRuntime().exec(pargs);
The JDK does not observe quotes or other shell substitutions, other than being
able to find an executable on your PATH. gcj's implementation is pretty close to
this. Starting a shell to handle every exec() call would add extra overhead that
we don't allways need/want.
[ bryce ]
- References:
- 2 things
- From: Simon Gornall <simon@unique-id.com>