Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/node/child_process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,8 @@ declare module "child_process" {
* @param modulePath The module to run in the child.
* @param args List of string arguments.
*/
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
interface SpawnSyncOptions extends CommonSpawnOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
maxBuffer?: number | undefined;
Expand Down
32 changes: 32 additions & 0 deletions types/node/test/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,24 @@ import { promisify } from "node:util";
ipc.ref();
}

{
const forked = childProcess.fork(new URL("file://test"), ["asd"] as readonly string[], {
windowsVerbatimArguments: true,
silent: false,
stdio: "inherit",
execPath: "",
execArgv: ["asda"],
signal: new AbortSignal(),
killSignal: "SIGABRT",
timeout: 123,
});
const ipc: Pipe = forked.channel!;
const hasRef: boolean = ipc.hasRef();
ipc.close();
ipc.unref();
ipc.ref();
}

{
const forked = childProcess.fork("./", {
windowsVerbatimArguments: true,
Expand All @@ -152,10 +170,24 @@ import { promisify } from "node:util";
});
}

{
const forked = childProcess.fork(new URL("file://test"), {
windowsVerbatimArguments: true,
silent: false,
stdio: ["inherit"],
execPath: "",
execArgv: ["asda"],
});
}

{
const forked = childProcess.fork("./");
}

{
const forked = childProcess.fork(new URL("file://test"));
}

async function testPromisify() {
const execFile = promisify(childProcess.execFile);
let r: { stdout: string | Buffer; stderr: string | Buffer } = await execFile("npm");
Expand Down
4 changes: 2 additions & 2 deletions types/node/v16/child_process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,8 @@ declare module "child_process" {
* @param modulePath The module to run in the child.
* @param args List of string arguments.
*/
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
interface SpawnSyncOptions extends CommonSpawnOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
maxBuffer?: number | undefined;
Expand Down
32 changes: 32 additions & 0 deletions types/node/v16/test/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ import { promisify } from "node:util";
ipc.ref();
}

{
const forked = childProcess.fork(new URL("file://test"), ["asd"] as readonly string[], {
windowsVerbatimArguments: true,
silent: false,
stdio: "inherit",
execPath: "",
execArgv: ["asda"],
signal: new AbortSignal(),
killSignal: "SIGABRT",
timeout: 123,
});
const ipc: Pipe = forked.channel!;
const hasRef: boolean = ipc.hasRef();
ipc.close();
ipc.unref();
ipc.ref();
}

{
const forked = childProcess.fork("./", {
windowsVerbatimArguments: true,
Expand All @@ -151,10 +169,24 @@ import { promisify } from "node:util";
});
}

{
const forked = childProcess.fork(new URL("file://test"), {
windowsVerbatimArguments: true,
silent: false,
stdio: ["inherit"],
execPath: "",
execArgv: ["asda"],
});
}

{
const forked = childProcess.fork("./");
}

{
const forked = childProcess.fork(new URL("file://test"));
}

async function testPromisify() {
const execFile = promisify(childProcess.execFile);
let r: { stdout: string | Buffer; stderr: string | Buffer } = await execFile("npm");
Expand Down
4 changes: 2 additions & 2 deletions types/node/v18/child_process.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1391,8 +1391,8 @@ declare module "child_process" {
* @param modulePath The module to run in the child.
* @param args List of string arguments.
*/
function fork(modulePath: string, options?: ForkOptions): ChildProcess;
function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
interface SpawnSyncOptions extends CommonSpawnOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
maxBuffer?: number | undefined;
Expand Down
32 changes: 32 additions & 0 deletions types/node/v18/test/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ import { promisify } from "node:util";
ipc.ref();
}

{
const forked = childProcess.fork(new URL("file://test"), ["asd"] as readonly string[], {
windowsVerbatimArguments: true,
silent: false,
stdio: "inherit",
execPath: "",
execArgv: ["asda"],
signal: new AbortSignal(),
killSignal: "SIGABRT",
timeout: 123,
});
const ipc: Pipe = forked.channel!;
const hasRef: boolean = ipc.hasRef();
ipc.close();
ipc.unref();
ipc.ref();
}

{
const forked = childProcess.fork("./", {
windowsVerbatimArguments: true,
Expand All @@ -151,10 +169,24 @@ import { promisify } from "node:util";
});
}

{
const forked = childProcess.fork(new URL("file://test"), {
windowsVerbatimArguments: true,
silent: false,
stdio: ["inherit"],
execPath: "",
execArgv: ["asda"],
});
}

{
const forked = childProcess.fork("./");
}

{
const forked = childProcess.fork(new URL("file://test"));
}

async function testPromisify() {
const execFile = promisify(childProcess.execFile);
let r: { stdout: string | Buffer; stderr: string | Buffer } = await execFile("npm");
Expand Down