[MAINTAINER EDIT: this ticket is now about possibly adding pty support for Windows so that really-wants-a-pty-to-behave-right applications can work there. See this comment.]
The example source code line can be found here.
Password for 'https://[email protected]':
You indicated pty=True, but your platform doesn't support the 'pty' module!
Implementing this hotfix (setting pty=False) resulted in the following output:
Password for 'https://[email protected]':
fatal: HttpRequestException encountered.
An error occurred while sending the request.
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Password for 'https://[email protected]': No error
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 384, in <module>
main()
File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 379, in main
PostGenProjectHook().run()
File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 371, in run
self._git_repo()
File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 328, in _git_repo
self._git_push()
File "C:\Users\user\AppData\Local\Temp\tmpvrxz271b.py", line 265, in _git_push
watchers=watchers,
File "c:\python37\lib\site-packages\invoke\__init__.py", line 49, in run
return Context().run(command, **kwargs)
File "c:\python37\lib\site-packages\invoke\context.py", line 94, in run
return self._run(runner, command, **kwargs)
File "c:\python37\lib\site-packages\invoke\context.py", line 101, in _run
return runner.run(command, **kwargs)
File "c:\python37\lib\site-packages\invoke\runners.py", line 271, in run
return self._run_body(command, **kwargs)
File "c:\python37\lib\site-packages\invoke\runners.py", line 404, in _run_body
raise UnexpectedExit(result)
invoke.exceptions.UnexpectedExit: Encountered a bad command exit code!
Command: 'git push --set-upstream origin master'
Exit code: 128
Stdout: already printed
Stderr: already printed
Thanks in advance for your time! 馃檪
Responder itself should be fine, I think the issue is just the use of pty=True/False - if you look at your first link you'll see comments about how the core issue is code that says pty=True will always fail on Windows. So some code in your stack somewhere is probably setting pty=True.
Is this just a request that we silently change pty=True to pty=False instead of raising an exception? Which would be understandable, though I'm not sure we'd want to do that (certainly, it's not something we can do without backwards compatibility issues). _May_ be worth an opt-in configuration setting like never_use_pty or whatnot.
If it's something else, please let me know!
Hey @bitprophet 馃憢 Thanks for your quick reply!
Sorry I was not clear enough in my original comment! I believe you're correct to say this is specifically a pty issue. The Responder is watching a git push -u origin master command, which I suspect may be writing directly to the local terminal according to the FAQ. Maybe I should change the issue title to _Add Windows pty support_ or similar?
A quick google search yields promising results: winpty and pywinpty 馃憤
That sounds reasonable to investigate, sure! I don't like having certain behaviors "walled off" for certain platforms, if I can help it.
I _suspect_ that a pile of additional code might be needed to leverage something like pywinpty (basically, it's competing with the simplicity of this chunk here) and I'm also not a big fan of having a lot of additional platform-specific code...so we'll see if those competing desires of mine can come to agreement. Hopefully I'm wrong and it'll only be a few lines of code though.
I use Invoke extensively but the rest of my colleagues use Windows and there are strange failures on Windows platforms for them (commands failing silently and invoke exiting without any console messages). I am holding out hope that these failures are due to the lack of pty support on Windows and would love to see this change come to fruition. I would also be happy to help with the PR, but I am unfortunately out of my element when it comes to programming around terminals/pty/forking etc.
winpty, preinstalled in Git Bash, does not fix the issue, it looks like its hardcoded to the OS platform.
Most helpful comment
That sounds reasonable to investigate, sure! I don't like having certain behaviors "walled off" for certain platforms, if I can help it.
I _suspect_ that a pile of additional code might be needed to leverage something like
pywinpty(basically, it's competing with the simplicity of this chunk here) and I'm also not a big fan of having a lot of additional platform-specific code...so we'll see if those competing desires of mine can come to agreement. Hopefully I'm wrong and it'll only be a few lines of code though.