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

[Bug] Cannot inintialize shell with correct path variables on Windows #101

Open
cworld1 opened this issue Sep 30, 2024 · 3 comments
Open

Comments

@cworld1
Copy link

cworld1 commented Sep 30, 2024

Description

In normal terminal application like Windows terminal, can correctly read user path or system path, but sshx cannot instead.

image

Try other way

I tried pwsh instead of fish, I got a new problem:

image

Process terminated. The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)       
   at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.TypeInitializationException: The type initializer for 'System.Management.Automation.Runspaces.InitialSessionState' threw an exception.
 ---> System.ComponentModel.Win32Exception (126): The specified module could not be found.
   at System.Management.Automation.Internal.SecuritySupport.GetSaferPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.TestSaferPolicy(String testPathScript, String testPathModule)
   at System.Management.Automation.Security.SystemPolicy.GetAppLockerPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.GetLockdownPolicy(String path, SafeHandle handle)
   at System.Management.Automation.Security.SystemPolicy.GetSystemLockdownPolicy()
   at System.Management.Automation.Runspaces.InitialSessionState..cctor()       
   --- End of inner exception stack trace ---
   at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault2()
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)

And I tried cmd instead, telling me cannot find executable application on the path.

image

@ekzhang
Copy link
Owner

ekzhang commented Sep 30, 2024

Thanks for the bug report! I've also seen this happen with Powershell on Windows, and I'm not sure why. It works with cmd.exe though and Git Bash.

Not sure how to set these environment variables properly so that Powershell can boot as a spawned process.

@cworld1
Copy link
Author

cworld1 commented Oct 6, 2024

The point I want to convey is that all of these terminals have the problem of not inheriting Windows system environment variables.
PowerShell is actually more problematic, but I don't use it very often.

@ekzhang
Copy link
Owner

ekzhang commented Oct 6, 2024

Okay! Let me know if you'd like to contribute a fix for this.

I honestly don't know how Windows works at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants