Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document windows shell support #16104

Closed
wants to merge 5 commits into from
Closed

doc: document windows shell support #16104

wants to merge 5 commits into from

Conversation

yamalight
Copy link
Contributor

Checklist
  • make -j4 test (UNIX)
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Fixes: #14100

Adds list of supported Windows shells and explains
that Git Bash and Cygwin require winpty to work correctly.

Fixes: #14100
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. labels Oct 9, 2017
@vsemozhetbyt
Copy link
Contributor

Some additions to consider:

  1. Add an example like this one.
  2. Note that winpty is already installed with git for Windows.

@vsemozhetbyt vsemozhetbyt added the windows Issues and PRs related to the Windows platform. label Oct 9, 2017
@gibfahn
Copy link
Member

gibfahn commented Oct 9, 2017

cc/ @nodejs/platform-windows

Add an example like this one.

Agreed, including the winpty node.exe script.js (and the note that says if you just do node script.js you get winpty by default) would be helpful.

Note that winpty is already installed with git for Windows.

Agreed

Add simple example of winpty usage and clarify that it gets installed
along with Git for Windows automatically.
@yamalight
Copy link
Contributor Author

@vsemozhetbyt @gibfahn added! please have a look and let me know if there are any other changes you want.

@Fishrock123
Copy link
Contributor

What about powershell? Is that officially supported or not?

(I would hope so, I need to tell almost everyone to at least use it on Windows rather than Cmd.exe. :/)

@yamalight
Copy link
Contributor Author

@Fishrock123 just tried running example snippet from ticket in powershell - it works OK. Interactive CLI also works fine (doesn't work on e.g. WSL without winpty).
Unless there are other known issues - powershell seems to be working OK.

BUILDING.md Outdated
note2 - Running Node.js on Windows is officially supported using Cmd. Running Node.js
through any other Windows shell (e.g. WSL, Git Bash, Cygwin, etc) is experimental.
Please note that running Node.js through Git Bash and Cygwin requires usage of [winpty](https://github.com/rprichard/winpty) (installed with Git for Windows) for Node.js to work
correctly (e.g. `winpty node.exe script.js`).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add something like:

If you call node without the .exe extension, winpty is used automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gibfahn that'd only be within git for windows, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

BTW Git for Windows === Git Bash, so maybe just use the latter for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gibfahn alright, got it. let me add that..

@vsemozhetbyt
Copy link
Contributor

Has anybody tried to build and run tests in powershell?

Added info on Git Bash running winpty automatically
when running node without .exe extension.
Changed "Git for Windows" to "Git Bash" for clarity.
@gibfahn
Copy link
Member

gibfahn commented Oct 9, 2017

Has anybody tried to build and run tests in powershell?

I think @refack was rewriting vcbuild.bat in powershell, so he might have tried it.

doesn't work on e.g. WSL without winpty

Interesting, possibly something we should look at.

@yamalight
Copy link
Contributor Author

@gibfahn should I open a ticket about it (interactive CLI not working on WSL)?

@gibfahn
Copy link
Member

gibfahn commented Oct 9, 2017

@gibfahn should I open a ticket about it (interactive CLI not working on WSL)?

I'd wait and see how this PR pans out. At the moment we don't officially support WSL.

BUILDING.md Outdated
@@ -59,6 +59,13 @@ note1 - The gcc4.8-libs package needs to be installed, because node
by Joyent. SmartOS images >= 16.4 are not supported because
GCC 4.8 runtime libraries are not available in their pkgsrc repository

note2 - Running Node.js on Windows is officially supported using Cmd. Running Node.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand the place this is coming from, but it's a way to complicated scenario to try to boil down to a Note...
For instance there's also PowerShell which is supported, WSL is a complete different animal (and is it Ubuntu or OpenSuse). Also it's completely Ok to run node without a shell (directly from a Windows app or via ❖Win + r).
Then there's the whole Git for Windows === Git Bash === MSYS ~== MinGW naming kerfuffle...
And as for terminal emulators, AFAIK winpty is only needed when using mintty. I don't know what happens when running MSYS Bash in Console2 or ComEmu...

tl;dr IMHO this should go in a different section with a simpler explanation of why winpty is needed and and which scenarios, and omit the "Officially supported" sentence since that's hard to define, and the sentence above is probably not the most correct approximation (for instance we CI on headless MSYS Bash but via python that traps the stdio file handlers).

@refack
Copy link
Contributor

refack commented Oct 9, 2017

Hello @yamalight, first of all welcome and thank you for the contribution 🥇

You've hit a complicated scenario, and I'm not sure the note in it's current form is the best way to approach this...
I'm sorry I don't have an outright better suggestion, but I promise to think about it.

@yamalight
Copy link
Contributor Author

@refack well, that issue was marked "good first contribution" 😂 but yeah, that doesn't seem to be quite as simple as it was outlined within the issue.
just let me know what changes to make once you figure out what you want to see here - I can wait 😄

@refack
Copy link
Contributor

refack commented Oct 9, 2017

Has anybody tried to build and run tests in powershell?

I think @refack was rewriting vcbuild.bat in powershell, so he might have tried it.

PowerShell builds and works fine. It's only the MSYS / MinGW terminal emulators that are tricky.
As I commented in my review, it's AFAIK it's not the MSYS Bash but rather mintty. I need to check how the stdios work when running "git bash" in ConEmu.

@gibfahn
Copy link
Member

gibfahn commented Oct 9, 2017

You've hit a complicated scenario, and I'm not sure the note in it's current form is the best way to approach this...

I think this is better than what we had before (nothing), so I'm +1 on landing it and iterating. Agreed that it's very complex.

@refack
Copy link
Contributor

refack commented Oct 9, 2017

@refack well, that issue was marked "good first contribution" 😂 but yeah, that doesn't seem to be quite as simple as it was outlined within the issue.
just let me know what changes to make once you figure out what you want to see here - I can wait 😄

I'd go with a minimal affirmative statement:

*Note*: Running node in windows terminal emulators like `mintty` requires the usage of
  [winpty](https://github.com/rprichard/winpty) for node's tty channels to work correctly
  (e.g. `winpty node.exe script.js`). In "Git bash" if you call the node shell wrapper
  (`node` without the `.exe` extension), `winpty` is used automatically.

P.S. We now tend to use *Note*: for note delimiters.
P.P.S. My paragraph is not 80 char aligned.

Simplify the explanation of node usage through non-standard windows shells.
@yamalight
Copy link
Contributor Author

@refack alright, changed that. Please check!

BUILDING.md Outdated
@@ -59,6 +59,12 @@ note1 - The gcc4.8-libs package needs to be installed, because node
by Joyent. SmartOS images >= 16.4 are not supported because
GCC 4.8 runtime libraries are not available in their pkgsrc repository

*Note*: Running node in windows terminal emulators like `mintty` requires the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify that this is only in regards to Windows, I'd change it to:

*Note*: On Windows, when running node in terminal emulators like...

@refack
Copy link
Contributor

refack commented Oct 9, 2017

Thanks for following up!

If you haven't already, it's recommended you take a look at CONTRIBUTING.md guide (especialy the part about "discuss and update"). Customarily PRs are kept open for at least 48 hour so that anyone interested gets a chance to comment or review.
Also documentation changes, while easy to do are more difficult to validate. With code we can write tests and the CI can validate the change. With documentation the only way to validate is with human eyes, so don't be dismayed if you get a lot of feedback.
Anyway thank you for the contribution, and good luck 🥇

P.S. If you have any question you can also feel free to contact me directly, here or on IRC

@refack refack self-assigned this Oct 9, 2017
Simple clarification that note about mintty and winpty is only relevant
when running Node.js on Windows
@yamalight
Copy link
Contributor Author

@refack got it. thanks for the guidance :)

requires the usage of [winpty](https://github.com/rprichard/winpty) for
Node's tty channels to work correctly (e.g. `winpty node.exe script.js`).
In "Git bash" if you call the node shell wrapper (`node` without the `.exe`
extension), `winpty` is used automatically.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd avoid adding this note because this is an implementation detail of "Git Bash" that could change anytime.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it's also a really odd thing that isn't documented anywhere else, and the difference between node and node.exe is very unobvious.

I think it's worth documenting that if you're on Git Bash, you should just use node without the .exe to get the required behaviour, so far I've only seen it documented in Github comments (including by you 😁 ) , e.g. #5620 (comment) and #3006 (comment).

this is an implementation detail of "Git Bash" that could change anytime.

🤷‍♂️ , if it changes we can change the docs, but I wouldn't call it an implementation detail, this is an alias Git Bash added to make life easier for Node users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ambivalent. I had both arguments in my head ("GfW quirk" vs. "Undocumented helper")...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, what's the final decision here? any changes needed from my side?

I personally think that it'd be better to mention it now and change later if needed, for all it's worth.

@refack
Copy link
Contributor

refack commented Oct 11, 2017

@seishun I'm considering your comment as non-blocking, ok?

Linter: https://ci.nodejs.org/job/node-test-linter/12504/ ✔️

refack pushed a commit that referenced this pull request Oct 12, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@refack
Copy link
Contributor

refack commented Oct 12, 2017

Landed in 641ba5e

@yamalight congratulations on getting promoted from:
image
to
image

@refack refack closed this Oct 12, 2017
addaleax pushed a commit to ayojs/ayo that referenced this pull request Oct 15, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: nodejs/node#16104
Fixes: nodejs/node#14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
targos pushed a commit that referenced this pull request Oct 18, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
targos pushed a commit that referenced this pull request Oct 18, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 16, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
MylesBorins pushed a commit that referenced this pull request Nov 21, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
explain that Git Bash and Cygwin require winpty to work correctly.
Added info on Git Bash running winpty automatically
when running node without .exe extension.

PR-URL: #16104
Fixes: #14100
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
@refack refack removed their assignment Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants