Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

.bat detection properly working uncovered several other logic errors …

…in windows exec code
  • Loading branch information...
commit 6982b6a9254c2804f3b8097fc41b12d1aa5b3bb8 1 parent b3370c8
@enebo enebo authored
View
2  src/main/java/jnr/posix/WindowsPOSIX.java
@@ -554,7 +554,7 @@ private static Errno mapErrorToErrno(int error) {
private WindowsChildRecord createProcess(String command, String program,
WindowsSecurityAttributes securityAttributes, Pointer input,
Pointer output, Pointer error, String[] envp) {
- if (command == null || program == null) {
+ if (command == null && program == null) {
handler.error(EFAULT, "no command or program specified");
return null;
}
View
7 src/main/java/jnr/posix/util/WindowsHelpers.java
@@ -31,6 +31,8 @@
}
public static byte[] toWString(String string) {
+ if (string == null) return null;
+
string += (char) 0;
try {
@@ -114,7 +116,10 @@ private static void joinSingleArgv(StringBuilder buffer, String arg,
public static String joinArgv(String command, String[] argv, boolean escape) {
StringBuilder buffer = new StringBuilder();
- if (command != null) buffer.append(command);
+ if (command != null) {
+ buffer.append(command);
+ buffer.append(' ');
+ }
int last_index = argv.length - 1;
for (int i = 0; i <= last_index; i++) {
Please sign in to comment.
Something went wrong with that request. Please try again.