Skip to content
Myr

Fix `options.detached` test (#215)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by Sindre Sorhus · parent d43460d · Browse files · 3 files+10 added−16 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−16 removed

  • other:+10 added−16 removed

3 files+10 added−16 removed

modified:fixtures/detach+4 added-9 removed
1#!/usr/bin/env node2const fs = require('fs');2'use strict';34const execa = require('..');55const fd = fs.openSync(process.argv[2], 'w');67const cp = execa('noop', ['foo'], {8 detached: true,9 stdio: ['ignore', fd]10});11cp.unref();126const subprocess = execa('node', ['./fixtures/forever'], {detached: true});7console.log(subprocess.pid);8process.exit();
modified:fixtures/forever+1 added-1 removed
1#!/usr/bin/env node2'use strict';34setTimeout(() => {}, 20000);4setTimeout(() => {}, 1e8);
modified:test.js+5 added-6 removed
579 unmodified lines
580 t.is(result, '....................\n');581});582583test('detach child process', async t => {584 const file = tempfile('.txt');584 const {stdout} = await execa('detach');585 const pid = Number(stdout);586 t.true(Number.isInteger(pid));587 t.true(isRunning(pid));588586 await execa('detach', [file]);587588 await delay(5000);589590 t.is(fs.readFileSync(file, 'utf8'), 'foo\n');589 process.kill(pid, 'SIGKILL');590});591592// See #128593test('removes exit handler on exit', async t => {
104 unmodified lines