/
githubmirror
/
deno
Обзор
Документация
Войти
/
githubmirror
/
deno
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/specs/node/child_process_stdio_socket/main.ts
38 строк
1 KB
Felipe Cardozo
fix(ext/node): make `child_process` stdio streams Socket instances (#31975)
02 фев 2026, 21:25
Не верифицирован
02 фев 2026, 21:25
0b38d25
Код
Авторство
О чём код?
import { spawn } from "node:child_process"; import { Socket } from "node:net"; // Test that stdio streams are Socket instances (Node.js compatibility) // Issue: https://github.com/denoland/deno/issues/31961 and https://github.com/denoland/deno/issues/25602 const cp = spawn("node", [], { stdio: "pipe", }); // stdout should be a Socket instance console.log("stdout instanceof Socket:", cp.stdout instanceof Socket); console.log( "stdout has unref:", "unref" in cp.stdout! && typeof cp.stdout!.unref === "function", ); // stderr should be a Socket instance console.log("stderr instanceof Socket:", cp.stderr instanceof Socket); console.log( "stderr has unref:", "unref" in cp.stderr! && typeof cp.stderr!.unref === "function", ); // stdin should be a Socket instance console.log("stdin instanceof Socket:", cp.stdin instanceof Socket); console.log( "stdin has unref:", "unref" in cp.stdin! && typeof cp.stdin!.unref === "function", ); // Verify that unref() can be called without error cp.stdout!.unref(); cp.stderr!.unref(); cp.stdin!.unref(); console.log("unref() calls succeeded"); cp.kill();