Created
August 5, 2017 03:12
-
-
Save IgorGee/a4118efa4c1f287d76a634a234d205a9 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 spawn = require('child_process').spawn | |
const exec = require('child_process').exec | |
const fork = require('child_process').fork | |
const miner = spawn("./miner.sh") | |
const shouldRestart = (line) => { | |
const launchFailString = new RegExp(/unspecified launch failure/) | |
const staleDataString = new RegExp(/Submitting stale solution/) | |
return launchFailString.test(line) || staleDataString.test(line) | |
} | |
miner.stdout.on('data', (data) => { | |
if (shouldRestart(data)) { | |
// exec('reboot') or fork("./stdoutScanner.js") | |
} | |
}) | |
miner.stderr.on('data', (data) => { | |
console.log(`stderr: ${data}`); | |
}); | |
miner.on('close', (code) => { | |
console.log(`Miner exited with code: ${code}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment