Created
February 14, 2019 16:40
-
-
Save Ladvace/2696336bf36c8259b82189273dc93c6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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