Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-1?Q?Sven_K=F6hler?= Newsgroups: comp.lang.java.programmer Subject: Re: exec problem is JDK 1.7.0_21 Date: Thu, 25 Apr 2013 11:59:53 +0300 Lines: 45 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.dfncis.de hraRJ3p3PJ/YOBSUyOKv4Af/kHJTy+dun5CmCjSKo8GKaOhWOuTFbSdLN4 Cancel-Lock: sha1:OzU21fWcwkszLpPDEai82xPCZP8= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130404 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:23642 On 04/25/2013 11:02 AM, Chris Uppal wrote: > Sven Köhler wrote: >> The specific case is broken. Now what? > > Then quite possibly you've hit the end of the road. Which should imply, that ProcessBuilder is currently broken on Windows. (Or as you said it: On Windows, ProcessBuilder is a disgrace) I was just hoping for a comment of Arved, since I really didn't understand the point of "let's test a specific case" while my point was "the general idea behind ProcessBuilder is broken, in case the OS is Windows". > Perhaps you can get around the limits of ProcessBuilder by (say) encoding the > desired command-line in base64 and using a helper application which will decode > it before passing it to Windows, but even with hacks like that, there's no > guarantee that you can pass arbitrary arguments to an arbitrary application. Passing arbitrary arguments to arbitrary applications is not always possible on Windows - which is a shame! However: assuming I know everything about the application I am calling, ProcessBuilder is not a big help in calling that application as it messes around with the command line parameters. My point is: on Windows, it shouldn't do so. Actually, on Windows, it should pass the second element of the String list as-is - without messing with it - and throw an exception if the String list contains more than 2 elements. For people that want escaping compatible with microsoft's default tokenization, ProcessBuilder should provide some helper function. ProcessBuilder should also provide some function to determine, what kind of OS you're dealing with, as the documentation, which contains statements like "on some operating systems" is not helping _at all_. > Depending on how its command-line parser is written it might be simply > impossible to pass, say, a single double-quote as an argument no matter /what/ > string you pass to Windows as the command-line. That is true. But with ProcessBuilder it is in general impossible to adapt to whatever command-line parser is implemented. That's just a shame, considering that ProcessBuilder is not that old. Regards, Sven