[Bug report] Runner constructs invalid command if parent process's arguments contain spaces (original) (raw)
Tomasz Grabiec tgrabiec at gmail.com
Wed May 1 04:13:11 PDT 2013
- Next message: [Bug report] Runner constructs invalid command if parent process's arguments contain spaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
2013/4/29 Aleksey Shipilev <aleksey.shipilev at oracle.com>:
On 04/29/2013 06:03 PM, Tomasz Grabiec wrote:
The problem is not limited to using IntelliJ but results from the fact IntelliJ runner sets some java properties to paths which contain spaces: -Didea.launcher.bin.path=C:\Program Files (x86) Thanks for the bug report! Yes, these should be escaped (in fact, JMH already escapes the forked classpath). Please check out the latest revision and try again. -Aleksey.
The latest version fixes the problem on Windows. However I tried the same thing on Linux today and it seems that it's broken now:
Forking using command: /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java "-Didea.launcher.port=7533" (...) Error: Could not find or load main class "-Didea.launcher.port=7533"
You could work it around by wrapping with quotes only when on windows, as you do with classpath. However this would not work if you had a path with spaces on Linux or a property with such value. Another solution which I can think of is not to concatenate strings while building a command but collecting a list of arguments and using new ProcessBuilder(List commands).
Regards, Tomek
- Next message: [Bug report] Runner constructs invalid command if parent process's arguments contain spaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]