31
31
import java .util .concurrent .Future ;
32
32
import java .util .function .BiConsumer ;
33
33
34
+ import edu .umd .cs .findbugs .annotations .Nullable ;
34
35
import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
35
36
36
37
/**
@@ -62,7 +63,7 @@ public Result shellWinUnix(String cmdWin, String cmdUnix) throws IOException, In
62
63
}
63
64
64
65
/** Executes the given shell command (using {@code cmd} on windows and {@code sh} on unix). */
65
- public Result shellWinUnix (File cwd , Map <String , String > environment , String cmdWin , String cmdUnix ) throws IOException , InterruptedException {
66
+ public Result shellWinUnix (@ Nullable File cwd , @ Nullable Map <String , String > environment , String cmdWin , String cmdUnix ) throws IOException , InterruptedException {
66
67
List <String > args ;
67
68
if (FileSignature .machineIsWin ()) {
68
69
args = Arrays .asList ("cmd" , "/c" , cmdWin );
@@ -78,7 +79,7 @@ public Result exec(String... args) throws IOException, InterruptedException {
78
79
}
79
80
80
81
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
81
- public Result exec (byte [] stdin , String ... args ) throws IOException , InterruptedException {
82
+ public Result exec (@ Nullable byte [] stdin , String ... args ) throws IOException , InterruptedException {
82
83
return exec (stdin , Arrays .asList (args ));
83
84
}
84
85
@@ -88,12 +89,12 @@ public Result exec(List<String> args) throws IOException, InterruptedException {
88
89
}
89
90
90
91
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
91
- public Result exec (byte [] stdin , List <String > args ) throws IOException , InterruptedException {
92
+ public Result exec (@ Nullable byte [] stdin , List <String > args ) throws IOException , InterruptedException {
92
93
return exec (null , null , stdin , args );
93
94
}
94
95
95
96
/** Creates a process with the given arguments, the given byte array is written to stdin immediately. */
96
- public Result exec (File cwd , Map <String , String > environment , byte [] stdin , List <String > args ) throws IOException , InterruptedException {
97
+ public Result exec (@ Nullable File cwd , @ Nullable Map <String , String > environment , @ Nullable byte [] stdin , List <String > args ) throws IOException , InterruptedException {
97
98
ProcessBuilder builder = new ProcessBuilder (args );
98
99
if (cwd != null ) {
99
100
builder .directory (cwd );
0 commit comments