Subprocess in toolkit app

I have a toolkit app that calls the python subprocess to run a shell command. It hangs and never completes. When I try to run the same subprocess command in a python shell, it works as expected. What would prevent the subprocess from completing? I’m running a js script in the subprocess.

Thanks,

Mark

Hey Mark!
Could there be maybe be something different about the environment variables?

Hey, we do this in multiple places, so it works by itself. You should check/debug your js process perhaps.

Thank you for the breadcrumb to look at the environment variables! I found the issue within the js script. The first line had a shebang.

#!/usr/bin/env node

When the subprocess ran, it didn’t have node in the $PATH. Subprocess was returning that the command was not found. At first I thought this was the js script. I updated the subprocess call to use the full path to node as /usr/local/bin/node. The solution looked something like this:
subprocess.call(['/usr/local/bin/node', '/path/to/jsscript.js', '-arg1', '-arg2'])

Thanks for the help,

Mark