Skip to content

Commit 9130e1c

Browse files
committed
processing-java: Run in headless mode with --build
Fixes #3996
1 parent 5639e93 commit 9130e1c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

app/src/processing/app/tools/InstallCommander.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ public void run() {
8686
PrintWriter writer = PApplet.createWriter(file);
8787
writer.println("#!/bin/sh");
8888

89+
90+
writer.print("\n# We don't want to steal focus for headless runs. See issue #3996.\n" +
91+
"OPTION_FOR_HEADLESS_RUN=\"\"\n" +
92+
"for ARG in \"$@\"\n" +
93+
"do\n" +
94+
" if [ $ARG = \"--build\" ]; then\n" +
95+
" OPTION_FOR_HEADLESS_RUN=\"-Djava.awt.headless=true\"\n" +
96+
" fi\n" +
97+
"done\n\n");
98+
8999
String javaRoot = Platform.getContentFile(".").getCanonicalPath();
90100

91101
StringList jarList = new StringList();
@@ -97,6 +107,7 @@ public void run() {
97107
writer.println("cd \"" + javaRoot + "\" && " +
98108
Platform.getJavaPath() +
99109
" -Djna.nosys=true" +
110+
" $OPTION_FOR_HEADLESS_RUN" +
100111
" -cp \"" + classPath + "\"" +
101112
" processing.mode.java.Commander \"$@\"");
102113
writer.flush();

0 commit comments

Comments
 (0)