Skip to content

Commit

Permalink
Merge pull request #60 from norswap/master
Browse files Browse the repository at this point in the history
Fix buffering of stdout on ribosome.js
  • Loading branch information
sustrik authored Sep 4, 2018
2 parents 10cd4cd + 8215a86 commit 40b856f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions ribosome.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,21 +630,17 @@ if (rnaopt) {
}

if (!rnaopt) {
exec("node" + rnafile + " " + process.argv.slice(3).join(' '), function(error, stdout, stderr) {
if(stderr != "") {
exec("node " + rnafile + " " + process.argv.slice(3).join(' '), function(error, stdout, stderr) {
process.stdout.write(stdout);
process.stdout.write(stderr);
fs.unlinkSync(rnafile);

if (error) {
process.exit(error.code);
}
});
} else {
process.stdout.write(stdout);
fs.unlinkSync(rnafile);
}
var proc = exec("node " + rnafile + " " + process.argv.slice(3).join(' '));
proc.stdout.pipe(process.stdout);
proc.stderr.pipe(process.stderr);

proc.on('exit', function (code) {
fs.unlinkSync(rnafile);
process.exit(code);
});
}

proc.on('error', function (code) {
fs.unlinkSync(rnafile);
process.exit(code);
});
}

0 comments on commit 40b856f

Please sign in to comment.