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

前端 未结 4 814
梦毁少年i
梦毁少年i 2021-02-09 01:55

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

st

相关标签:
4条回答
  • 2021-02-09 02:09

    node generateData.js > db.json runs on Visual Studio Code's Terminal : bash

    0 讨论(0)
  • 2021-02-09 02:15

    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
    
    0 讨论(0)
  • 2021-02-09 02:19

    I had same problem on console "stdout is not a tty"

    This because of console, while installing Git there is an option which is choosing default terminal. Install again Git and choose terminal as Windows console and after that it should be fine.

    0 讨论(0)
  • 2021-02-09 02:28

    Diagnose :

    Theres nothing wrong with the code, I get the following output : (OS : ArchLinux)

      add: two numbers add correctly
    
        ✔ should be equal
    
    
      total:     1
      passing:   1
      duration:  14ms
    

    Its probably a problem with Windows 7 Git Bash Shell

    I read somewhere : sending output through a pipe is broken with Git Bash

    To discard it run the following command :

    node -p -e "Boolean(process.stdout.isTTY)"
    

    For it to work you need the following output : true


    Solution (for Windows):

    $ node -p -e "Boolean(process.stdout.isTTY)"
    false
    

    Using the winpty tool, it creates a hidden console and marshals I/O between it and Cygwin/GitBashshell emulated pty :

    $ winpty node -p -e "Boolean(process.stdout.isTTY)"
    true
    

    READ MORE : Node.js doesn't run as tty on windows / cygwin Issue#3006

    0 讨论(0)
提交回复
热议问题