-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
pipenv shell starts a CMD shell when run from powershell #915
Comments
@pfmoore this is actually a bug in |
lol thanks for the clarification :-) |
@erinxocon Any idea when the fix will be released? (or if there's a work around for the time being?) |
@lllama no ETA yet, it's on my to do list, just been busy with work! I'll try and expedite this as I'm starting to use windows more and more for work and this bothers me too. |
@erinxocon thanks for the reply. If anyone else is experiencing this, you can just launch powershell from within cmd and you'll still have paths and deps setup and installed. |
If anyone else is wondering about this, then it appears to have been fixed with version 11.1.8. (or possibly earlier) |
Stealth-fixed in 2dc06d4 |
I'm still seeing this same behaviour when running powershell on Cmder, so I was wondering if there's any interested in having that fix or if users are except to use only PS or CMD. I have no idea what is causing this particular issue, but I could take a stab at it would be a desirable change. |
@hstefan Cmder works perfectly for me with either cmd and Powershell, so this could be environment-dependent. Please do help improve it if possible! |
@hstefan you need to provide more details, such as which version of pipenv you are using. For context, taking a stab at this would involve reimplementing the ctypes process tree traversal I implemented which initially resolved this. You should let us know what you have set for environment variables, one of those might be causing issues (@uranusjr what is your |
@uranusjr, @techalchemy thanks for the comments! I'm running Please let me know if there's more info that I can provide |
@hstefan the output of |
Ah, I think I know what’s going on here. On certain code paths for Cmder you go through this function in Pew: https://github.com/pypa/pipenv/blob/v11.10.3/pipenv/patched/pew/pew.py#L185 As the name indicates, this spawns a new shell when it detects you’re using Cmder—but it always spawns a cmd, never Powershell. @hstefan Can you add a few breakpoints on Pipenv to confirm if this is indeed the code path you go through when you run This could be a little tricky to fix (since we’d need to know what Cmder shell you’re in), but I think it’s possible. |
Hm that might not be relevant anymore on second thought |
Yeah |
I bet we can just remove the special behavior in cmder now, I am sure that was there because of the old way pew used to handle the shell determination on windows using psutil |
open for tracking the cmder specific issue |
We can for Powershell, as long as we detect its profile file ( I can probably come up with something… |
Hey @uranusjr! It seems like we do hit the path you asked about, here's the stack trace I got from running
|
Also, I've tested #2161 briefly and it seems like it does fix the problem, or at least the launched shell is actually powershell. I haven't tested it thoroughly, but please let me know if there's anything specific I can help with. |
@hstefan if you get a chance, just test it on as many windows shells as you can (cmder/cmd.exe/powershell/etc) since this is going to require manual checks to make sure it works. That's the main thing. I'll slot this in for 11.11 |
Also if anyone’s interested this would be a good chance to get Msys |
@uranusjr I use msys2 with fish and run all of that via cmder. I’ll test it out tomorrow ;) |
@uranusjr I've tested bash on msys2 and cmder, and the weirdest thing I've seen was PATH being converted to windows-style paths and basically screwing up every binary that I previously had in PATH. Do you have plans to fix msys bash support in that same PR? Otherwise I'd be interested in trying to help out with that during my extended weekend this week. |
@hstefan Give this a shot! I don’t use the Msys2 Bash much, and does not have it set up in Cmder either (I deleted the default entry), Any work from me at this front would be mostly be done in the dark; I’d very much need someone to be able to test it more extensively. I plan to work on restructuring the |
@uranusjr I've digged a bit into what was going on with bash on windows: apparently we were generating a PATH format that was not well-suited for the platform, as it would contain some entries as posix-style paths and others windows-style. I've made two changes which seem to have made msys bash work fine now (at least the version packaged with git for windows), one was using So, should I open a PR to your fork including said changes? Or would it be better if I just sent you a patch? |
I’m guessing it’s easier to pr to the relevant branch |
Yup, my changes are here (in a branch, not forked repo), so you can simply open a PR to this repo. |
Hey there, |
I use powershell as my primary shell, but
pipenv shell
starts a CMD prompt.Describe you environment
$ python -V
3.6.2$ pipenv --version
8.2.6Expected result
I'd expect the shell that was started to be the same as my current shell (i.e., powershell)
Actual result
The shell is always a CMD shell, as far as I can see there is no way to change this.
Steps to replicate
pipenv shell
. It's possible to work around this by usingpipenv run powershell
but this doesn't set$env:VIRTUAL_ENV
(which I believe is a known issue).The text was updated successfully, but these errors were encountered: