const tty = require('tty');
if(tty.isatty(0)) {
process.stdin = new tty.ReadStream();
} else {
//init process.stdin from other stream
}
var outStream;
if(tty.isatty(1)) {
outStream = new tty.WriteStream();
process.stdout = outStream;
} else {
//init process.stdout from other stream
}
if(tty.isatty(2)) {
if(!outStream) {
outStream = new tty.WriteStream();
}
process.stderr = outStream;
} else {
//init process.stderr from other stream
}