npm-java-runner
Advanced tools
Comparing version 0.0.14 to 0.0.15
#!/usr/bin/env node | ||
"use strict"; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -10,36 +17,9 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
var fs_1 = __importDefault(require("fs")); | ||
var shelljs_1 = require("shelljs"); | ||
var spawn = require('child_process').spawn; | ||
function executeJar(jarFile) { | ||
var userArgs = process.argv.slice(2); | ||
var javaArgs = []; | ||
var programArgs = []; | ||
userArgs.forEach(function (arg) { | ||
if (arg.startsWith('-D') || arg.startsWith('-X') || arg.startsWith('-P')) { | ||
javaArgs.push(arg); | ||
} | ||
else { | ||
programArgs.push(arg); | ||
} | ||
}); | ||
var cmd = 'java'; | ||
javaArgs.forEach(function (arg) { | ||
cmd += " " + arg; | ||
}); | ||
cmd += " -jar " + jarFile + " "; | ||
programArgs.forEach(function (arg) { | ||
cmd += " " + arg; | ||
}); | ||
var child = shelljs_1.exec(cmd, { async: true }); | ||
process.stdin.setEncoding('utf8'); | ||
process.stdin.on('readable', function () { | ||
var chunk = process.stdin.read(); | ||
if (chunk === null) { | ||
return; | ||
} | ||
try { | ||
child.stdin.write(chunk); | ||
} | ||
catch (e) { } | ||
}); | ||
child.on('close', function (code) { | ||
var command = spawn('java', __spreadArrays(['-jar', jarFile], userArgs)); | ||
command.stdout.pipe(process.stdout); | ||
command.stderr.pipe(process.stderr); | ||
command.on('close', function (code) { | ||
process.exit(code); | ||
@@ -46,0 +26,0 @@ }); |
{ | ||
"name": "npm-java-runner", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"scripts": { | ||
@@ -10,5 +10,3 @@ "build": "npm run format && tsc -p .", | ||
"dependencies": { | ||
"@types/shelljs": "^0.8.9", | ||
"path": "^0.12.7", | ||
"shelljs": "^0.8.4" | ||
"path": "^0.12.7" | ||
}, | ||
@@ -15,0 +13,0 @@ "devDependencies": { |
@@ -10,6 +10,2 @@ # NPM Java Runner | ||
Example: | ||
- [Git Changelog Command Line](https://github.com/tomasbjerre/git-changelog-command-line) | ||
## Usage | ||
@@ -16,0 +12,0 @@ |
Sorry, the diff of this file is not supported yet
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
1
6263
66
38
1
- Removed@types/shelljs@^0.8.9
- Removedshelljs@^0.8.4
- Removed@types/glob@7.2.0(transitive)
- Removed@types/minimatch@5.1.2(transitive)
- Removed@types/node@22.12.0(transitive)
- Removed@types/shelljs@0.8.15(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinterpret@1.4.0(transitive)
- Removedis-core-module@2.16.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedrechoir@0.6.2(transitive)
- Removedresolve@1.22.10(transitive)
- Removedshelljs@0.8.5(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedwrappy@1.0.2(transitive)