New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSX: processing-java stealing focus even with --build flag #3996

Closed
myrjola opened this Issue Oct 14, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@myrjola
Contributor

myrjola commented Oct 14, 2015

I want to use processing-java with the --build flag for on-the-fly syntax checking ptrv/processing2-emacs#8.

The problem I'm facing on OSX is that every time processing-java is run it steals focus from the editor, even though no window is created. This makes editing the code as syntax checking is running a frustrating experience. I can reproduce this by running processing-java from the terminal as well.

I found out a fix, which is to add -Djava.awt.headless=true to the java run options in /usr/local/bin/processing-java. I didn't notice any issues when running my sketches, but does anyone more knowledgeable in Java settings know what that headless-option could break?

@myrjola

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Oct 14, 2015

Contributor

I guess one solution to this problem would be to add a conditional to processing-java, that adds -Djava.awt.headless=true to the java command line parameters if --build has been used. This will marginally increase the complexity of processing-java, but would otherwise be a simple enough solution.

Contributor

myrjola commented Oct 14, 2015

I guess one solution to this problem would be to add a conditional to processing-java, that adds -Djava.awt.headless=true to the java command line parameters if --build has been used. This will marginally increase the complexity of processing-java, but would otherwise be a simple enough solution.

@benfry

This comment has been minimized.

Show comment
Hide comment
@benfry

benfry Oct 14, 2015

Member

Appreciate you looking into it and finding a fix.

Member

benfry commented Oct 14, 2015

Appreciate you looking into it and finding a fix.

@neilpanchal

This comment has been minimized.

Show comment
Hide comment
@neilpanchal

neilpanchal Nov 8, 2015

/usr/local/bin/processing-java: line 8: [: too many arguments /usr/local/bin/processing-java: line 8: [: too many arguments Listening for transport dt_socket at address: 8439

I get this error since this change in sublime text build console. Is this related?

It has been a bit frustrating to run Processing in sublime text. Something changed in version 3.0. The command line output works approx 50% of the time. When I build using "Cmd+B" in ST3, it almost seems random that I get command line output. Sometimes, the program builds but I get no println() outputs and if I build it again, by random chance it works. It is really intermittent.

neilpanchal commented Nov 8, 2015

/usr/local/bin/processing-java: line 8: [: too many arguments /usr/local/bin/processing-java: line 8: [: too many arguments Listening for transport dt_socket at address: 8439

I get this error since this change in sublime text build console. Is this related?

It has been a bit frustrating to run Processing in sublime text. Something changed in version 3.0. The command line output works approx 50% of the time. When I build using "Cmd+B" in ST3, it almost seems random that I get command line output. Sometimes, the program builds but I get no println() outputs and if I build it again, by random chance it works. It is really intermittent.

@myrjola

This comment has been minimized.

Show comment
Hide comment
@myrjola

myrjola Nov 10, 2015

Contributor

@neilpanchal, interesting find. I think I found the explanation and solution for the problem http://stackoverflow.com/questions/13781216/bash-meaning-of-too-many-arguments-error-from-if-square-brackets.

Could you try by applying this diff to /usr/local/bin/processing-java

@@ -5,7 +5,7 @@
 OPTION_FOR_HEADLESS_RUN=""
 for ARG in "$@"
 do
-    if [ $ARG = "--build" ]; then
+    if [ "$ARG" = "--build" ]; then
         OPTION_FOR_HEADLESS_RUN="-Djava.awt.headless=true"
     fi
 done

So just put double quotes around $ARG.

Contributor

myrjola commented Nov 10, 2015

@neilpanchal, interesting find. I think I found the explanation and solution for the problem http://stackoverflow.com/questions/13781216/bash-meaning-of-too-many-arguments-error-from-if-square-brackets.

Could you try by applying this diff to /usr/local/bin/processing-java

@@ -5,7 +5,7 @@
 OPTION_FOR_HEADLESS_RUN=""
 for ARG in "$@"
 do
-    if [ $ARG = "--build" ]; then
+    if [ "$ARG" = "--build" ]; then
         OPTION_FOR_HEADLESS_RUN="-Djava.awt.headless=true"
     fi
 done

So just put double quotes around $ARG.

myrjola added a commit to myrjola/processing that referenced this issue Nov 14, 2015

Small fix to processing-java generation
Related to #3996.

Now it doesn't give an error when there is quotation in the command line
args.

Related comments:
processing#3996 (comment)
processing#3996 (comment)
@neilpanchal

This comment has been minimized.

Show comment
Hide comment
@neilpanchal

neilpanchal Nov 16, 2015

@myrjola Works perfectly, I just tested it. Thanks! Closing #4119

neilpanchal commented Nov 16, 2015

@myrjola Works perfectly, I just tested it. Thanks! Closing #4119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment