You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Processing is great if one wants to take some input data and transform it into an image or an animation. Moreover, I think it can be also very useful for the other direction, namely: take an image as input, analyse it, print the result as text. However, processing-java always produces some debug output, which has to be removed either by stream redirection or some other tools like awk or sed.
Example
voidsetup() {
/* load some images, grab pixels, do some calculations */println("Very useful result = " + 42);
exit();
}
If I call it as follows:
processing-java --sketch="nameOfTheSketch" --run
the expected output would be:
Very useful result = 42
but the actual output is:
Listening for transport dt_socket at address: 8651
Very useful result = 42
Finished.
Problem
There are two unexpected lines printed to stdout: the first line is the cryptic message "Listening for transport dt_socket at address:" followed by a random 4-digit number. The last message is always trivially true.
Proposed solutions
Short solution
Eliminate both messages altogether. In processing/java/src/processing/mode/java/Commander.java delete the line
systemOut.println("Finished.");
and in processing/java/src/processing/mode/java/runner/Runner.java
replace the line
Processing is great if one wants to take some input data and transform it into an image or an animation. Moreover, I think it can be also very useful for the other direction, namely: take an image as input, analyse it, print the result as text. However,
processing-java
always produces some debug output, which has to be removed either by stream redirection or some other tools likeawk
orsed
.Example
If I call it as follows:
processing-java --sketch="nameOfTheSketch" --run
the expected output would be:
but the actual output is:
Listening for transport dt_socket at address: 8651 Very useful result = 42 Finished.
Problem
There are two unexpected lines printed to stdout: the first line is the cryptic message "Listening for transport dt_socket at address:" followed by a random 4-digit number. The last message is always trivially true.
Proposed solutions
Short solution
Eliminate both messages altogether. In
processing/java/src/processing/mode/java/Commander.java
delete the lineand in
processing/java/src/processing/mode/java/runner/Runner.java
replace the line
by
This solution might break some existing code (maybe someone already uses this in a script, and drops the first line of the output).
Long(er) solution
Add a
--quiet
flag toprocessing-java
. This is not complicated either, I've implemented it here:https://github.com/tyukiand/processing/commit/3cfa89c4e360711dd4ac665f224771648744f309
(link to commit)
Now, one can call
processing-java
as follows:processing-java --sketch="nameOfTheSketch" --quiet --run
and it would produce only:
This does not break any existing scripts that use
processing-java
, but it would make the STDOUT more useful than it is right now.The text was updated successfully, but these errors were encountered: