Pipes in here Strings seem to be broken

42 Views Asked by At

I'm trying to use a here string to execute a new powershell command from a rust application.

The Rust application creates this string, which is then executed:

Start-Process powershell -ArgumentList '-noexit', @'
docker exec "$Env:DOCKER_CONTAINER" powershell -C "Get-Content /mnt/backup/cb_backend_v0_1/$($RESTORE_FILE.Name) | mysql -u root -p$Env:PASSWORD";
'@

Running just the docker exec command works as expected, but when ran via Start-Process it fails with mysql : The term 'mysql' is not recognized as the name of a cmdlet...

This should not happen, because the binary is inside the container and accessible when running the command "the normal way".

I would greatly apprechiate any help on how to fix this issue.

(PS: This is not a rust issue, I tried all of these commands in a normal powershell console as well)

0

There are 0 best solutions below