Closed callum-george closed 5 years ago
I have the same problem. I was wondering why it is not running my python commands inside the virtual environment and this is the answer
Same issue here. Big +1 for this to be fixed.
What is the resolution here? I see that it is closed, but I just ran into this issue. Is there a fix? Is there a work around? I'm happy to upload more specifics about my case, but I wanted to verify I wasn't missing the fix somewhere. Thanks in advance!
If my jenkins job is contained in a folder with a space in its name, the virtual environment is created but it doesn't get activated. No error is thrown but any commands contained within the withPythonEnv run on the global environment.
The root cause of the issue appears to be due to the getVirtualenvUnixDurableTask method. This line:
String script = ". " + directoryName + "/bin/activate; env";
doesn't guarantee it will create a safe path.Also - the runTaskAndCapture method that subsequently runs the script, doesn't handle errors appropriately. The shell script generated uses the -e switch to force it to exit on errors, yet the code doesn't handle the non-zero exit code. Instead it just interprets the output regardless.