ChatCrawlersearch across public Telegram Open the app
T

TypeScript Ecosystem

115 members
27 July 2026
I remember something like: Bun.c` int foo(int) { ... } `;
T
But more flexible API is nice too I guess
T
I don't use that stuff anyway
D
Is that statement applicable to Deno overall?
T
But now it's just node as the boss
D
fs.watch("./", { recursive: true, encoding: "utf-8" }, (eventType, fileName)=>{ if(eventType === "change"){ console.log("[RESTART] on file changes -", fileName); exec("node ./src/index.ts", (error, stdout, stderr)=>{ console.log(error); }); } }); I was trying to build a Nodemon clone, and I have written the logic above to try restart the program when there is some change in the file contents. But the exec() part does not work. What am I doing wrong here?
D
Should I use process here?
You should manage the process lifecycle of the process you start
I'd use spawn over exec here. You need to assign the process to a variable so you can access it later and call kill() on it.
W
Super basic example: import fs from "node:fs"; import { spawn, type ChildProcess } from "node:child_process"; let child: ChildProcess | undefined; let timer: NodeJS.Timeout; function restart() { child?.kill(); child = spawn("npx", ["tsx", "./src/index.ts"], { stdio: "inherit", shell: true, }); } fs.watch("./src", { recursive: true }, (_eventType, filename) => { if (!filename) return; clearTimeout(timer); timer = setTimeout(restart, 100); }); restart();
D
I also did a stupid mistake here by trying to run on the source file itself. Nodemon Clone - index.ts fs.watch - index.ts
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog