Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Ladvace
Created February 14, 2019 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ladvace/2696336bf36c8259b82189273dc93c6f to your computer and use it in GitHub Desktop.
Save Ladvace/2696336bf36c8259b82189273dc93c6f to your computer and use it in GitHub Desktop.
const stringio = require('@rauschma/stringio');
const child = require('child_process');
const start = child.spawn(`java -Xms512M -Xmx1024M -jar ./TEST-FILE.jar`,
[], { shell: true });
async function writeToWritable(writable, data) {
console.log("WRITABLE", writable);
//await stringio.streamWrite(writable, data);
// await streamWrite(writable, 'Second line\n');
//await stringio.streamEnd(writable);
await writable.write(data);
await writable.end(data);
}
async function runCommand(){
try {
const paramL = `/command commandParameter`;
await writeToWritable(start.stdin, paramL);
} catch {
}
}
(() => {
try{
setTimeout(runCommand, 20000);
setTimeout(runCommand, 30000);
}catch(err){
console.log(err);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment