From 0d8e764b7bbc198b3855ccecc6e2c4ca2ea6297d Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 16 Feb 2024 17:44:38 -0600 Subject: [PATCH] wip --- shell/watcher.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/shell/watcher.js b/shell/watcher.js index c16d24e..4aee66b 100644 --- a/shell/watcher.js +++ b/shell/watcher.js @@ -7,12 +7,14 @@ const socketPath = '/tmp/oscar_watcher.sock'; let progvars = {}; // Remove the socket file if it already exists -try { - fs.unlinkSync(socketPath); -} catch (err) { - if (err.code !== 'ENOENT') { - console.error('Error removing existing socket file:', err); - process.exit(1); +if (fs.existsSync( socketPath )) { + try { + fs.unlinkSync(socketPath); + } catch (err) { + if (err.code !== 'ENOENT') { + console.error('Error removing existing socket file:', err); + process.exit(1); + } } }