Uh oh!
There was an error while loading. Please reload this page.
Allow setting detached - #29
Conversation
munro
commented
Dec 24, 2019
It looks like the Travis CI broke support building for Python 2.6, 3.2, 3.3, annoying... I think I have to manually specify the Ubuntu distribution for these Python versions |
munro
commented
Apr 27, 2020
@mifi I still haven't dug into the travis-ci error, so any help to get this moving is greatly appreciated! Also if you could write an automated test that uses I think the integration test could be done pretty easily, here's some pseudo code: constisRunning=require('is-running');asyncfunctiontest(){// to do an automated test for this, we need to run our JS code in another process// so that when that process exits, we can test that the Python process is still running.constprocessPythonPid=awaitsomeFunctionThatSpawnAProcess(async()=>{constpythonBridge=require('./');constpython=pythonBridge({detached: true});awaitpython.exec`import os`;constpythonPid=python`os.getpid()`;t.equal(pythonPid,python.pid,'same pid');python.ps.unref();returnpython.ps.pid;});t.assertTrue(awaitisRunning(processPythonPid),'python process is still running after nodejs terminated');process.kill(processPythonPid,'SIGKILL');}functionsomeFunctionThatSpawnAProcess(f){// @TODO do we have to write this, or is there an NPM module for this?}Alternatively, you could launch a detached process for background work from the Python side, which wouldn't require any changes to the Anyway, I'm pretty easy going, so I'd love to know your thoughts, or if you found another solution. |
mdesmet
commented
Oct 26, 2022
I don't think that test would be easy. We could spawn another process through Not sure I follow the alternative solution regarding the Python background process. The Python process is launched by the exact |
Allow setting detached: true on the child process so that we can prevent it from propagating signals from parent