Skip to main content
Deno 2 is finally here 🎉️
Learn more

Spawn Detached Child Process

Question

Why do I build this

More often than not I will spawn a child process that start their own process, and I have to kill it sometimes, togther with the sub-child process it created.

In order to kill those sub-child processes created/spawned, the child process itself must be detached

Sometimes, I will use this piece of repeated code in a script or in source code too, hence this package was made to help me as it more centralized

How to use

import SpawnDetachedChildProcess from 'spawn-detached-child-process';

const childProcess = SpawnDetachedChildProcess.create({
    command: string,
    args: ReadonlyArray<string>,
    options: child.SpawnOptions,
});

childProcess.start();
childProcess.terminate();

Additional information

You can contribute if you want to, just

  1. Create and commit to a new branch
  2. Write test code
  3. Create a Pull Request

OR

You can raise issue(s) if you prefer that way

How to use

yarn add spawn-detached-child-process

OR

npm i spawn-detached-child-process

OR

pnpm add spawn-detached-child-process