Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
874 views
in Technique[技术] by (71.8m points)

node.js - stdout is not a tty. Using bash for node + tape + tap-spec

Was looking at a tape + tap video and tried to get it to work.
OS: Windows 7 Git Bash Shell

node main.js | ./node_modules/.bin/tap-spec

stdout is not a tty.

main.js:

var test = require('tape');
var add = require('./add');

test('add: two numbers add correctly', function(t) {
var actual = add(1,2);
var expected = 3;
t.equal(actual, expected);
t.end();
});

add.js:

module.exports = function(a, b) {
return a + b;
};

winpty node main.js | ./node_modules/.bin/tap-spec doesn't fix the problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Just to add my case, I was facing similar issue. Neither solution of using winpty did help, thus I used different hint on using node.exe instead of node when running a script (from Git bash in my case).

not working:

node myscript.js < some-input.txt > some-output.txt

working:

node.exe myscript.js < some-input.txt > some-output.txt

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...