简体   繁体   中英

Node, Windows 10 and Bash interaction. Pipe doesn't work

Note that the following command line hangs under bash running almost any version of node that I've tried (can you give me one where it works?) or my Windows 10 system is hosed. It does work under command prompt.

$ yes | xargs node fillbuffer.js | tee xx
0
0


$ cat fillbuffer.js
console.log(0);

I've installed a new bash and bash utilities under cygwin and git bash (should I try msys?).

Note that this works:

$ yes | xargs sh fill.sh | tee xx
0
0
.
.
.

$ cat fill.sh
echo 0

I discovered the solution to my problem. It may not solve all node problems, because in many cases, you don't want to exit. Here's the solution:

fillbuffer.js:

console.log(0);
process.exit();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM