You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

npm-java-runner

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npm-java-runner - npm Package Compare versions

Comparing version

to
0.0.11

@@ -10,15 +10,38 @@ #!/usr/bin/env node

var fs_1 = __importDefault(require("fs"));
var child_process_1 = __importDefault(require("child_process"));
function execute(command) {
child_process_1.default.exec(command, function (error, stdout, stderr) {
if (error) {
console.error(error);
var shelljs_1 = require("shelljs");
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);
}
if (stderr) {
console.error(stderr);
else {
programArgs.push(arg);
}
if (stdout) {
console.log(stdout);
});
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) {
process.exit(code);
});
}

@@ -56,5 +79,5 @@ function search(dir, regex) {

var runnableJar = resolveRunnableJar(runnableJarRegexp, userPath);
execute("java -jar " + runnableJar);
executeJar(runnableJar);
}
exports.run = run;
//# sourceMappingURL=index.js.map
{
"name": "npm-java-runner",
"version": "0.0.10",
"version": "0.0.11",
"scripts": {

@@ -10,3 +10,5 @@ "build": "npm run format && tsc -p .",

"dependencies": {
"path": "^0.12.7"
"@types/shelljs": "^0.8.9",
"path": "^0.12.7",
"shelljs": "^0.8.4"
},

@@ -13,0 +15,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet