When I tried to use Jawk-1.02 in a Jsr223 (Java scripting) environment, I experienced that System.out and System.err stopped working once a Jawk-script was executed. I dug into the Jawk-1.02 source and discovered that System.in, System.out and System.err are actually rerouted using System.setIn(), System.setOut() and System.setErr() calls. This appears to me as a very dangerous way of managing Jawk's stdin, stdout and stderr.
If Jawk is supposed to be embeddable in Java-applications, it should not be using System.in, System.out or System.err, should it?. If a thread using System.in/out/err is executing simultanously as a thread of the Jawk-interpreter, and System.in/out/err is rerouted, strange things will happen.
Best regards!
Olle
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
When I tried to use Jawk-1.02 in a Jsr223 (Java scripting) environment, I experienced that System.out and System.err stopped working once a Jawk-script was executed. I dug into the Jawk-1.02 source and discovered that System.in, System.out and System.err are actually rerouted using System.setIn(), System.setOut() and System.setErr() calls. This appears to me as a very dangerous way of managing Jawk's stdin, stdout and stderr.
If Jawk is supposed to be embeddable in Java-applications, it should not be using System.in, System.out or System.err, should it?. If a thread using System.in/out/err is executing simultanously as a thread of the Jawk-interpreter, and System.in/out/err is rerouted, strange things will happen.
Best regards!
Olle