-
Notifications
You must be signed in to change notification settings - Fork 904
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
Make refreshenv.bat error if powershell.exe is being used #1392
Comments
I think I've solved this problem: beatcracker/choco@9e0d484 . Unfortunately I don't feel like signing CLA. Could you use my solution if I to release it separetely with some very permissive license (WTFPL or something like that)? |
@beatcracker how will this work if say I'm in powershell.exe and then call cmd.exe to go into that prompt before calling refreshenv? |
Looks like it could work. Don't feel like signing the CLA or are unable to? |
It will refresh env. vars inside that
Don't feel like. It requires sharing my personal data and this is something I'm very reluctant to do. Sorry about that. |
Understood. It probably won't help, but the data goes nowhere. We don't share it with anyone. Set up something generic in a repository and give it a very permissive license. Then we can take a closer look. |
Sure, will MIT be suitable? |
MIT is perfect. |
So I took the sample code from @beatcracker for a spin (as well as previously having done some investigating on this myself). I had hoped to use a separate file that could be fully attributed to beatcracker, but it appears that's not possible (if you call the cmd from within a cmd, it detects as being run interactively 😅 ). I have a bit of work to do to get it ready for a PR, but should have a PR up for this by the end of the month 😄 |
Detect when the calling shell is not cmd.exe and issue a message that it does not work on that shell.
(#1392) Update refreshenv to detect when not in cmd shell
@vexx32 can you update this issue with the milestone is this work intended to go out on? |
If someone has the powershell profile installed, they would never call this as refreshenv is an alias for Update-SessionEnvironment.
This is quite difficult to determine. I found https://stackoverflow.com/a/16376399/18475, but it won't work if you drop from PowerShell.exe to cmd.exe to run commands, and I haven't found a way to capture the current title and set it back yet.
It also doesn't determine the difference between cmd started up just to run a batch and a long term child process of cmd.exe that you get if you open PowerShell and then drop into cmd.exe (call
cmd.exe
in PowerShell opens a child process). The script found can not tell the difference between the two.The text was updated successfully, but these errors were encountered: