java-caller 2.6.0 → 3.0.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.
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "java-caller",
3
- "version": "2.6.0",
3
+ "version": "3.0.0",
4
4
  "description": "Library to easily call java from node sources. Automatically installs java if not present",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -36,15 +36,15 @@
36
36
  "homepage": "https://github.com/nvuillam/node-java-caller#readme",
37
37
  "dependencies": {
38
38
  "debug": "^4.3.4",
39
- "fs-extra": "^10.1.0",
40
- "njre": "^0.3.0"
39
+ "fs-extra": "^11.1.1",
40
+ "njre": "^1.0.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/eslint-parser": "^7.19.1",
44
44
  "eslint": "^8.27.0",
45
45
  "mocha": "^10.1.0",
46
46
  "nyc": "^15.1.0",
47
- "which": "^3.0.0"
47
+ "which": "^4.0.0"
48
48
  },
49
49
  "engines": {
50
50
  "node": ">=12.0.0"