2016-05-23 28 views

回答

1

只要打开它作为一个文件,并写入它:)

var fs = require('fs'); 
var tty = fs.createWriteStream('/dev/tty'); 

console.log('hello'); 
tty.write('foo\n'); 
tty.write('bar\n'); 
0

所以我找到了一种方法,但可能被视为作弊;)

var exec = require('child_process').exec 
process.stdout.write('writing to stdout') 
exec("echo 'writing to the terminal without writing to stdout' > /dev/tty") 
相关问题