Skip to content

child_process: allow promisified exec to be cancel

Using new experimental AbortController, add support for promised exec to be canceled.

Through AbortController, add support to promisified version of exec and execFile being able to be canceled using AbortController. e.g.

const { promisify } = require('util');
const { exec } = require('child_process');
const execPromisifed = promisify(exec);

const pwdcommand = 'pwd';
const dir = '/dev';
const ac = new AbortController();
const signal = ac.signal;

execPromisifed(pwdcommand, { cwd: dir, signal })

ac.abort();
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading