java-caller 2.6.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/java-caller.js +3 -0
- package/package.json +1 -1
package/lib/java-caller.js
CHANGED
|
@@ -66,6 +66,7 @@ class JavaCaller {
|
|
|
66
66
|
* @param {string[]} [userArguments] - Java command line arguments
|
|
67
67
|
* @param {object} [runOptions] - Run options
|
|
68
68
|
* @param {boolean} [runOptions.detached = false] - If set to true, node will node wait for the java command to be completed. In that case, childJavaProcess property will be returned, but stdout and stderr may be empty
|
|
69
|
+
* @param {string} [runOptions.stdoutEncoding = 'utf8'] - Adds control on spawn process stdout
|
|
69
70
|
* @param {number} [runOptions.waitForErrorMs = 500] - If detached is true, number of milliseconds to wait to detect an error before exiting JavaCaller run
|
|
70
71
|
* @param {string} [runOptions.cwd = .] - You can override cwd of spawn called by JavaCaller runner
|
|
71
72
|
* @param {string} [runOptions.javaArgs = []] - You can override cwd of spawn called by JavaCaller runner
|
|
@@ -75,6 +76,7 @@ class JavaCaller {
|
|
|
75
76
|
runOptions.detached = runOptions.detached || false;
|
|
76
77
|
runOptions.waitForErrorMs = runOptions.waitForErrorMs || 500;
|
|
77
78
|
runOptions.cwd = runOptions.cwd || process.cwd();
|
|
79
|
+
runOptions.stdoutEncoding = runOptions.stdoutEncoding || 'utf8';
|
|
78
80
|
this.commandJavaArgs = (runOptions.javaArgs || []).concat(this.additionalJavaArgs);
|
|
79
81
|
|
|
80
82
|
let javaExe = this.javaExecutable;
|
|
@@ -110,6 +112,7 @@ class JavaCaller {
|
|
|
110
112
|
|
|
111
113
|
// Gather stdout and stderr if they must be returned
|
|
112
114
|
if (spawnOptions.stdio === "pipe") {
|
|
115
|
+
child.stdout.setEncoding(`${runOptions.stdoutEncoding}`);
|
|
113
116
|
child.stdout.on("data", (data) => {
|
|
114
117
|
stdout += data;
|
|
115
118
|
});
|