You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On windows cargo fails to execute a python script that is defined as a runner for a target in .cargo/config
This happens both when using cygwin and powershell to call cargo.
Here is a minimal example: https://github.com/jschwe/cargo_windows_python_test_runner_bug_example
The error produced by cargo is: could not execute process `C:\Users\jschw\CLionProjects\python_runner\tests/runner.py C:\Users\jschw\CLionProjects\python_runner\target\debug\dep s\integration_test-27f6506d67a39760.exe` (never executed)
The script contains a shebang which obviously works fine on unix, but it should work on windows too since .py files are registered to be executed by python. Calling the process printed in the error output directly from powershell works, on cygwin it works if you adjust the path to the cygwin path style.
I don't know how cargo currently invokes the runner so I have no idea if this is a simple fix or not.
Notes
Prepending 'python3' to the runner path (e.g. runner = "python3 tests/runner.py") doesn't work (currently) either, since then the path to my script would have to be absolute.
My use case is I'm using a python script as a wrapper to run the integration tests executable in qemu and possibly parse the output.
Windows doesn't have native support for shebang style executables. Cargo uses the normal command execution facilities, so it is not aware of file associations or anything like that.
Why doesn't using a runner like "python3 tests/runner.py" work for you? It shouldn't need an absolute path.
Ah I'm sorry, it seems I confused some things and didn't look closely enough at the error message. python tests/runner.py actually does work, I just had an issue with my path since I didn't expect python3 to only be available under the python command.
Problem
On windows cargo fails to execute a python script that is defined as a runner for a target in
.cargo/config
This happens both when using cygwin and powershell to call cargo.
Here is a minimal example: https://github.com/jschwe/cargo_windows_python_test_runner_bug_example
The error produced by cargo is:
could not execute process `C:\Users\jschw\CLionProjects\python_runner\tests/runner.py C:\Users\jschw\CLionProjects\python_runner\target\debug\dep s\integration_test-27f6506d67a39760.exe` (never executed)
The script contains a shebang which obviously works fine on unix, but it should work on windows too since .py files are registered to be executed by python. Calling the process printed in the error output directly from powershell works, on cygwin it works if you adjust the path to the cygwin path style.
Steps
git clone https://github.com/jschwe/cargo_windows_python_test_runner_bug_example.git
cargo test
orcargo test --test integration_test
Possible Solution(s)
I don't know how cargo currently invokes the runner so I have no idea if this is a simple fix or not.
Notes
Prepending 'python3' to the runner path (e.g.
runner = "python3 tests/runner.py"
) doesn't work (currently) either, since then the path to my script would have to be absolute.My use case is I'm using a python script as a wrapper to run the integration tests executable in qemu and possibly parse the output.
Output of
cargo version
:cargo 1.45.0-nightly (9fcb8c1 2020-05-25)
The text was updated successfully, but these errors were encountered: