Skip to content

Commit 7b5f019

Browse files
committed
Fix a bug in how ProcessRunner handled null stdin.
1 parent bc4a268 commit 7b5f019

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/src/main/java/com/diffplug/spotless/ProcessRunner.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Result shellWinUnix(File cwd, Map<String, String> environment, String cmd
6969
} else {
7070
args = Arrays.asList("sh", "-c", cmdUnix);
7171
}
72-
return exec(cwd, environment, new byte[0], args);
72+
return exec(cwd, environment, null, args);
7373
}
7474

7575
/** Creates a process with the given arguments. */
@@ -101,6 +101,9 @@ public Result exec(File cwd, Map<String, String> environment, byte[] stdin, List
101101
if (environment != null) {
102102
builder.environment().putAll(environment);
103103
}
104+
if (stdin == null) {
105+
stdin = new byte[0];
106+
}
104107
Process process = builder.start();
105108
Future<byte[]> outputFut = threadStdOut.submit(() -> drainToBytes(process.getInputStream(), bufStdOut));
106109
Future<byte[]> errorFut = threadStdErr.submit(() -> drainToBytes(process.getErrorStream(), bufStdErr));

0 commit comments

Comments
 (0)