From 150ea4f231c9629ef9ef354e3f1a92a516d46f91 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 11 Dec 2014 18:00:25 +0100 Subject: Bug 1108 - IOUtil.getTempDir(..): Difficulties to determine executable access permission on Windows via BATCH file execution Try using explicit call to Windows 'cmd.exe' w/ referencing the BATCH file location, via 'Runtime.getRuntime().exec(new String[] { "cmd", "/c", "a.bat" } );' While the bug itself could not be reproduced here, I could test on Windows 7 (64bit and 32bit), as well as an WindowsXP 32bit that no regression occured. --- src/java/com/jogamp/common/util/IOUtil.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java index 5f3ae01..ac011af 100644 --- a/src/java/com/jogamp/common/util/IOUtil.java +++ b/src/java/com/jogamp/common/util/IOUtil.java @@ -668,6 +668,14 @@ public class IOUtil { return null; } } + private static String[] getShellCommandArgs(final String scriptFile) { + switch(PlatformPropsImpl.OS_TYPE) { + case WINDOWS: + return new String[] { "cmd", "/c", scriptFile }; + default: + return new String[] { scriptFile }; + } + } private static boolean getOSHasNoexecFS() { switch(PlatformPropsImpl.OS_TYPE) { @@ -823,7 +831,7 @@ public class IOUtil { } // Using 'Process.exec(String[])' avoids StringTokenizer of 'Process.exec(String)' // and hence splitting up command by spaces! - final Process pr = Runtime.getRuntime().exec(new String[] { exetst.getCanonicalPath() } ); + final Process pr = Runtime.getRuntime().exec( getShellCommandArgs( exetst.getCanonicalPath() ) ); /** * Disable StreamMonitor, which throttles exec-test performance a lot! * -- cgit v1.2.3