Skip to content

Invalid signal: SIGINT process.kill("SIGINT") #92

Closed
@dong-lufei

Description

@dong-lufei

https://deno.land/[email protected]/examples/subprocess

I follow the code at the bottom of the document page to execute an invalid type error

import { mergeReadableStreams } from "https://deno.land/[email protected]/streams/merge_readable_streams.ts";

// create the file to attach the process to
const file = await Deno.open("./hello.txt", {
  read: true,
  write: true,
  create: true,
});

// start the process
const process = Deno.run({
  cmd: ["yes"],
  stdout: "piped",
  stderr: "piped",
});

// example of combining stdout and stderr while sending to a file
const joined = mergeReadableStreams(
  process.stdout.readable,
  process.stderr.readable,
);

// returns a promise that resolves when the process is killed/closed
joined.pipeTo(file.writable).then(() => console.log("pipe join done"));

// manually stop process "yes" will never end on its own
setTimeout(() => {
  process.kill("SIGINT"); //Change to SIGTERM, no error
}, 100);

error: Uncaught TypeError: Invalid signal: SIGINT
process.kill("SIGINT"); //SIGTERM
^
at opKill (deno:runtime/js/40_process.js:21:9)
at Process.kill (deno:runtime/js/40_process.js:99:7)
at file:///E:/test/deno/deno01/index.ts:648:11
at Object.action (deno:ext/web/02_timers.js:147:13)
at handleTimerMacrotask (deno:ext/web/02_timers.js:64:12)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions