This is the mail archive of the java-discuss@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 2 things


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 ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]