-
Notifications
You must be signed in to change notification settings - Fork 744
Problems getting code, stdout, stderr #715
Copy link
Copy link
Closed
Description
Node version (or tell us if you're using electron or some other framework):
node v.6.9.1
ShellJS version (the most recent version/Github branch you see the bug on):
(most recent)
Operating system:
windows 10
Description of the bug:
// simple c++ files to compute factorial
// with prints to stderr & stdout, and exit codes
//
#include <stdio.h>
#include <stdlib.h>
int factorial(int n)
{
if (n == 1)
return 1;
else
return n*factorial(n-1);
}
int main(int argc, char *argv[]) {
fprintf (stderr, "test");
if ( argc != 2 ) {
fprintf (stdout, "0\n");
exit(1);
}else {
fprintf (stdout, "%d", factorial( atoi(argv[1]) ) );
exit(0);
}
}
Example ShellJS command to reproduce the error:
// as simple as this ...
//
var shelljs = require('shelljs');
shelljs.exec('./factorial.exe ' + 5, function(code, stdout, stderr) {
console.log('code: ' + code);
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
});
///////////////////////////////////////////////////////////////////////////////////////
Get this weird result
$ node main-win.js
'.' ���O�����Υ���R�O�B�i���檺�{���Χ妸�ɡC���R�O�B�i���檺�{���Χ妸�ɡC
code: 1
stdout:
stderr: '.' ���O�����Υ
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels