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

Launching vagrant as a subprocess in Python on Windows causes it to think it's running in WSL #8860

Closed
pfaffle opened this issue Aug 7, 2017 · 6 comments

Comments

@pfaffle
Copy link

pfaffle commented Aug 7, 2017

I have some automation which is driven by Python and also makes use of Vagrant (among other things). Since the Vagrant 1.9.7 update, launching Vagrant as a subprocess within my Python scripts is broken on my system. Something about how Python launches the subprocess seems to make Vagrant think it's being run in the WSL environment, which is not my intention and I haven't set it up to be run that way. The reason I think it's trying to run in WSL is because running the same Vagrant command works in PowerShell (shown in my gist link), but if I run it in Bash on Ubuntu on Windows, I get the same error that Vagrant's output gives me in Python.

I see that there are new docs on the Vagrant website describing how to do it, but I don't have a need for that right now. I'd like to just have it run in the regular Windows environment like it used to.

Note that what I did in the gist works fine for me on Vagrant 1.9.6.

Vagrant version

Vagrant 1.9.7

Host operating system

Windows 10 Build 15063

Guest operating system

n/a

Vagrantfile

n/a

Debug output

https://gist.github.com/pfaffle/cb1381b1ece7d31c02e4878ab7b06a08

Expected behavior

Vagrant should have launched the vagrant.exe binary in a Windows shell.

Actual behavior

Vagrant launched it in WSL Bash, and errored out.

Steps to reproduce

  1. Install Vagrant 1.9.7
  2. Install the Creator's Update, WSL and Ubuntu on Windows 10
  3. Install Python 3.4.3
  4. Run the Python interpreter, import the subprocess module, and try to spawn Vagrant in a subprocess.
@pfaffle
Copy link
Author

pfaffle commented Aug 7, 2017

I've also tried changing the command line executed by Python to be cmd /c vagrant -v, and setting Shell=False which doesn't fix things either.

@robwiss
Copy link

robwiss commented Aug 8, 2017

I don't think vagrant is supposed to report stdin is not a tty when run from the WSL. This may be linked to #8858.

@robwiss
Copy link

robwiss commented Aug 15, 2017

I created this issue against BashOnWindows, perhaps some of the replies there could be helpful.

microsoft/WSL#2406

@chrisroberts
Copy link
Member

I believe the 1.9.8 release should have resolved this issue. @pfaffle can you confirm if you are still seeing this issue or if it has been resolved with the latest release? Thanks!

@pfaffle
Copy link
Author

pfaffle commented Aug 28, 2017

@chrisroberts Yes, it works in Vagrant 1.9.8. Thank you!

@pfaffle pfaffle closed this as completed Aug 28, 2017
@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants