From 582f74ceb1ecaae724da126145f14846863ae45f Mon Sep 17 00:00:00 2001 From: Cyn Date: Thu, 23 Dec 2021 14:59:01 -0500 Subject: [PATCH] let watcher self update --- src/watcher.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/watcher.ts b/src/watcher.ts index 32ce33e..43ba503 100644 --- a/src/watcher.ts +++ b/src/watcher.ts @@ -24,9 +24,13 @@ export async function main(ns : NS) : Promise { }) for(const process of processes) { - ns.tprint(`INFO: Restarting ${process.filename} ${process.args} -t ${process.threads}`) - ns.kill(process.pid, ns.getHostname()) - ns.run(process.filename, process.threads, ...process.args) + if(process.filename != ns.getScriptName()) { + ns.tprint(`INFO: Restarting ${process.filename} ${process.args} -t ${process.threads}`) + ns.kill(process.pid, ns.getHostname()) + ns.run(process.filename, process.threads, ...process.args) + } else { + ns.spawn(process.filename, process.threads, ...process.args) + } } hashes[file] = hash