2016-05-23 23 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") 
相關問題