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); + } } }