mirror of
https://github.com/nodejs/node.git
synced 2025-05-12 00:24:09 +00:00

Move tmpdir functionality to its own module (common/tmpdir). PR-URL: https://github.com/nodejs/node/pull/17856 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
37 lines
1.0 KiB
JavaScript
37 lines
1.0 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
|
|
const CODE = `console.log(
|
|
process.binding("trace_events").categoryGroupEnabled("custom")
|
|
);`;
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
tmpdir.refresh();
|
|
process.chdir(tmpdir.path);
|
|
|
|
const procEnabled = cp.spawn(
|
|
process.execPath,
|
|
[ '--trace-events-enabled', '--trace-event-categories', 'custom', '-e', CODE ]
|
|
);
|
|
let procEnabledOutput = '';
|
|
|
|
procEnabled.stdout.on('data', (data) => procEnabledOutput += data);
|
|
procEnabled.stderr.pipe(process.stderr);
|
|
procEnabled.once('exit', common.mustCall(() => {
|
|
assert.strictEqual(procEnabledOutput, 'true\n');
|
|
}));
|
|
|
|
const procDisabled = cp.spawn(
|
|
process.execPath,
|
|
[ '--trace-events-enabled', '--trace-event-categories', 'other', '-e', CODE ]
|
|
);
|
|
let procDisabledOutput = '';
|
|
|
|
procDisabled.stdout.on('data', (data) => procDisabledOutput += data);
|
|
procDisabled.stderr.pipe(process.stderr);
|
|
procDisabled.once('exit', common.mustCall(() => {
|
|
assert.strictEqual(procDisabledOutput, 'false\n');
|
|
}));
|