Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support CLI based app #8

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions src/ca/weblite/jdeploy/jdeploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ function getEmbeddedJavaDir() {
default:
fail('unsupported platform: ' + _platform);
}

var jreDir = getJdeploySupportDir() + path.sep + 'node_modules' + path.sep + 'node-jre' + path.sep + 'jre';

try {
return jreDir + path.sep + getDirectories(jreDir)[0] + path.sep + _driver;
} catch (e) {
Expand Down Expand Up @@ -123,15 +123,15 @@ if (javaVersion === false || javaVersion < 1.8 || env['JDEPLOY_USE_NODE_JRE']) {
// Could not find embedded java dir
// We need to install it.
fail("Could not find embedded java at "+getEmbeddedJavaDir());

} else {
// Found the embedded version. Add it to the PATH
env['PATH'] = getEmbeddedJavaDir() + path.delimiter + env['PATH']
console.log("Now java version is "+getJavaVersion());
fail("Path is now "+env['PATH']);
}
*/

}
//console.log("Java version is "+getJavaVersion());

Expand All @@ -150,16 +150,14 @@ programArgs.forEach(function(arg) {
var child = exec(cmd, {async: true});
process.stdin.setEncoding('utf8');

process.stdin.on('readable', () => {
var chunk = process.stdin.read();
if (chunk === null) {

return;
process.stdin.on('readable', function() {
var chunk = null;
while (null !== (chunk = process.stdin.read())) {
try {
child.stdin.write(chunk);
} catch(e){}
}
try {
child.stdin.write(chunk);
} catch(e){}
});
child.on('close', function(code) {
process.exit(code);
});
});