You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually a pretty interesting one. in Python, for example, I can spawn bash just fine with the subprocess module, but only under certain circumstances. consider the following script:
I am sure that it is much more complicated than this, but bash.exe seems to be really, really offended by stream redirection with pipes. that doesn't clearly explain why OP is having a problem with node.js, but note that this is exactly the same error that you would get if you ever try to pipe something into bash.exe at all. for instance:
C:\Users\Justin>type rocks.sh
#!/bin/bash
echo "bash on Windows ????!" | sed 's/????/rocks/g'
C:\Users\Justin>bash rocks.sh
bash on Windows rocks!
C:\Users\Justin>type rocks.sh | bash
Error: 0x80070057
C:\Users\Justin>type rocks.sh | bash -c "sh"
Error: 0x80070057
C:\Users\Justin>bash -c "sh"
# rocks.sh
bash on Windows rocks!
# exit
C:\Users\Justin>bash -c "sh" < rocks.sh
Error: 0x80070057
C:\Users\Justin>echo "./rocks.sh" | bash -c "sh"
Error: 0x80070057
Can confirm. This is a problem with bash having problems with output piping. If I specify { stdio: 'inhert' }, it works but that way I then have no way of getting that data. { stdio: 'pipe' } produces the error above
Thank you so much for this! This has been my most anticipated feature for the Linux Subsystem since i first heard about it. I am enjoying it immensely, and can confirm that it now works exactly as one would imagine it would. Thanks again!!!!!
Activity
justinhixson commentedon Apr 7, 2016
This is actually a pretty interesting one. in Python, for example, I can spawn bash just fine with the
subprocessmodule, but only under certain circumstances. consider the following script:this is saved as bash.py
c:\>python bash.pyworksalso works
however, I found it very interesting that
does NOT work. same
Error: 0x80070057(note that something like
does indeed work.)
I was using python 3.5 for these tests.
I am sure that it is much more complicated than this, but bash.exe seems to be really, really offended by stream redirection with pipes. that doesn't clearly explain why OP is having a problem with node.js, but note that this is exactly the same error that you would get if you ever try to pipe something into
bash.exeat all. for instance:RaeesBhatti commentedon Apr 7, 2016
Can confirm. This is a problem with bash having problems with output piping. If I specify
{ stdio: 'inhert' }, it works but that way I then have no way of getting that data.{ stdio: 'pipe' }produces the error above[-]Unable to spawn Bash from other programs[/-][+]Unable to pipe Bash output to other programs[/+]MadcowD commentedon May 1, 2016
I've made a related issue in Bash on Windows. #312
bitcrazed commentedon Jun 22, 2017
Thanks for the issue report - this was fixed in Creators Update.
justinhixson commentedon Jun 23, 2017
Thank you so much for this! This has been my most anticipated feature for the Linux Subsystem since i first heard about it. I am enjoying it immensely, and can confirm that it now works exactly as one would imagine it would. Thanks again!!!!!