Skip to content

Does not work properly in WindowsΒ #40

@joshua-classen

Description

@joshua-classen

I spawn a python Process in my Electron App. On the python process runs a Flask server. In my Electron App I spawn the Python process with

const { spawn } = require('child_process');
const treeKill = require('tree-kill');
const path = require('path');

const projectPath = path.join(__dirname, '../');
const pathToPython = path.join(projectPath, '/Venv/Scripts/python');
const pythonOptions = [path.join(projectPath, '/pythonBackend/app.py')];

let ls = spawn(pathToPython, pythonOptions);

I later kill the process with

treeKill(ls.pid);

I can see in the Process Explorer from Microsoft that the tree also gets killed,but after a milisecond, the python process somehow respawns as a standalone process.

If I kill the exact same process tree in the Process Explorer from Windows, then the tree gets killed and there is no crazy respawn of the python process. I don't know why its respawning with the tree-kill module. Any Ideas?

UPDATE
I use now the module tree-kill-promise. https://www.npmjs.com/package/tree-kill-promise This worked for me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions