Skip to content

doc: readline on "Git Bash" - winpty required #14100

Description

@starkwang
  • Version: master
  • Platform: Windows7, Git Bash
  • Subsystem: readline

On Windows7, the Node.js application don't terminate after rl.close() :

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});
rl.close();

It causes test/parallel/test-readline-interface.js TIMEOUT, which will not happen in v6.x.x

Activity

  1. changed the title [-]readline: Process don't terminate after readline.close()[/-] [+]readline: process don't terminate after readline.close()[/+] on Jul 6, 2017
  2. added
    readlineIssues and PRs related to the built-in readline module.
    windowsIssues and PRs related to the Windows platform.
    on Jul 6, 2017
  3. vsemozhetbyt commented on Jul 6, 2017

    @vsemozhetbyt
    Contributor

    FWIW, I can not reproduce the issue on Windows with v4, v6, v8 or v9.

  4. starkwang commented on Jul 6, 2017

    @starkwang
    ContributorAuthor

    This only happens in Git Bash.
    In PowerShell or cmd, It's fine.

  5. vsemozhetbyt commented on Jul 6, 2017

    @vsemozhetbyt
    Contributor

    cc @nodejs/platform-windows, @addaleax, @Fishrock123

  6. tniessen commented on Jul 6, 2017

    @tniessen
    Member

    I can repoduce this. A similar and probably related problem occurs when executing node.exe without arguments, which should normally start the built-in repl, but does not under Git Bash. node.exe -i starts the repl, so I assume the console / tty configuration does not work correctly in Git Bash.

  7. vsemozhetbyt commented on Jul 6, 2017

    @vsemozhetbyt
    Contributor

    Someone told me Node.js supported building only with cmd.exe on Windows. I am not sure if we support test runs in other shells or work in other shells at all(

  8. joaocgreis commented on Jul 6, 2017

    @joaocgreis
    Member

    This looks like a duplicate of #5620 .

    Please always use winpty when running Node on Git Bash. Actually, if you run just node, Git Bash will add winpty for you. But if you run node.exe, a different file name or with a path, you have to use winpty. Try:

    winpty node.exe script.js
    
  9. added
    docIssues and PRs related to Node.js documentation.
    on Jul 6, 2017
  10. refack commented on Jul 6, 2017

    @refack
    Contributor

    Please always use winpty when running Node on Git Bash.

    So I'd suggest we document this, but also disclaim official support (Experimental / YMMV) for: Git Bash / MSYS / MinGW / Cygwin / WSL

  11. changed the title [-]readline: process don't terminate after readline.close()[/-] [+]doc: readline on "Git Bash" - process don't terminate after `readline.close()` - `winpty` required[/+] on Jul 6, 2017
  12. changed the title [-]doc: readline on "Git Bash" - process don't terminate after `readline.close()` - `winpty` required[/-] [+]doc: readline on "Git Bash" - process doesn't terminate after `readline.close()` - `winpty` required[/+] on Jul 6, 2017
  13. changed the title [-]doc: readline on "Git Bash" - process doesn't terminate after `readline.close()` - `winpty` required[/-] [+]doc: readline on "Git Bash" - `winpty` required[/+] on Jul 6, 2017
  14. seishun commented on Jul 6, 2017

    @seishun
    Contributor

    Your test case is effectively:

    process.stdin.resume();
    process.stdin.pause();

    When running in Git Bash, GetFileType on stdin returns FILE_TYPE_PIPE rather than FILE_TYPE_CHAR. Consequently, Node.js doesn't consider it a TTY and sets its highWaterMark to the default value of 16384, rather than 0 as in cmd.

    Once you're resumed a stream, it will read until it has read highWaterMark bytes or EOF. Pausing only takes action after a chunk is read. So in your case, the process will exit once you enter 16384 bytes or EOF.

    I say we close this since Git Bash is not supported. We can create a separate issue for documentation.

  15. 3 remaining items

  16. yamalight commented on Oct 9, 2017

    @yamalight
    Contributor

    @refack @starkwang I could document that. Can you please point me as to where that would need to be added?

  17. yamalight commented on Oct 9, 2017

    @yamalight
    Contributor

    The only place that mentions platform support seems to be node/deps/uv/SUPPORTED_PLATFORMS.md - would that be the right place to add this info?

  18. gibfahn commented on Oct 9, 2017

    @gibfahn
    Member

    @yamalight the place we document our platform support is here: https://github.com/nodejs/node/blob/master/BUILDING.md#supported-platforms-1

    Not sure what @refack had in mind, but I'd assume something like adding a note2 to the Windows section to say that running through cmd is supported, but running through any other shell is experimental (and then mention winpty for Git Bash and Cygwin).

  19. yamalight commented on Oct 9, 2017

    @yamalight
    Contributor

    @gibfahn thanks, got it. Will make a PR soon 👍

  20. yamalight commented on Oct 9, 2017

    @yamalight
    Contributor

    PR created. Please let me know if you want any changes.

  21. added
    wipIssues and PRs that are still a work in progress.
    and removed
    good first issueIssues that are suitable for first-time contributors.
    on Oct 10, 2017
  22. added a commit that references this issue on Oct 15, 2017
  23. added a commit that references this issue on Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to Node.js documentation.readlineIssues and PRs related to the built-in readline module.windowsIssues and PRs related to the Windows platform.wipIssues and PRs that are still a work in progress.wslIssues and PRs related to the Windows Subsystem for Linux.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions