From 4f4c2a0696bcc0cbdaeed8eb274c58b120cbeb21 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 14 Dec 2024 18:39:28 +0530 Subject: [PATCH] fix(ext/node): emit `resize` event on SIGWINCH ``` process.stdout.on("resize", () => { console.log("resize"); }); ``` --- ext/node/polyfills/process.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index 647376d5cf..a30b078acd 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -964,6 +964,11 @@ internals.__bootstrapNodeProcess = function ( "stdout", ); } + if (stdout.isTTY) { + Deno.addSignalListener("SIGWINCH", () => { + stdout.emit("resize"); + }); + } if (!io.stderr.isTerminal()) { /** https://nodejs.org/api/process.html#process_process_stderr */ @@ -972,6 +977,11 @@ internals.__bootstrapNodeProcess = function ( "stderr", ); } + if (stderr.isTTY) { + Deno.addSignalListener("SIGWINCH", () => { + stderr.emit("resize"); + }); + } arch = arch_(); platform = isWindows ? "win32" : Deno.build.os;