Open felixfbecker opened 6 years ago
Hmm I never considered running a shell script.
PSWsl was made to run PowerShell inside of the wsl distros not a shell script.
That said, supporting running shell scripts as well is a reasonable feature request!
As a workaround, I bet you could do something like:
Invoke-WslCommand -Command "bash myscript.sh"
haven't tested it though.
Well PowerShell was designed to be able to call native commands. I can see that the shell script is getting executed (some logs come through) but then the error occurs.
Maybe I can try to capture the output of the shell script into a file and cat
that for a reproducible example. It doesn't happen when e.g. just executing -Command "echo hi"
.
@felixfbecker yes PowerShell was designed to call native commands but a shell script isn't a native command in the same sense that ls, ps and grep are.
I'm curious... are you able to run the shell script in a normal instance of pwsh? (rather than going through PSWsl)
steps:
ps/cmd> wsl
bash > pwsh
PS > ./myscript.sh
yes PowerShell was designed to call native commands but a shell script isn't a native command in the same sense that ls, ps and grep are.
Calling a shell script is the same as calling bash
and passing the script as a parameter, which is a native command, so I wouldn't expect it to behave any differently.
I'm curious... are you able to run the shell script in a normal instance of pwsh? (rather than going through PSWsl)
Yes, it works completely fine. I think something here must be wrong with the XML serialisation/deserialisation of the output that the script generates.
Yes, it works completely fine. I think something here must be wrong with the XML serialisation/deserialisation of the output that the script generates.
Very possible! Are you able to share an example script that causes this error?
I am running
Invoke-WslCommand -Command myscript.sh
to execute a shell script and am getting the following error:WSL PSVersionTable:
Windows PSVersionTable: