From ee24820b591123c5ebde347639da4b2f54841e5a Mon Sep 17 00:00:00 2001 From: rounak bhatia Date: Fri, 30 Jan 2026 23:06:48 +0530 Subject: [PATCH] use writeFileSync instead of echo to clear the logfile --- lib/Local.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Local.js b/lib/Local.js index ad35fd4..26efac4 100644 --- a/lib/Local.js +++ b/lib/Local.js @@ -37,7 +37,11 @@ function Local(){ const binaryPath = this.getBinaryPath(null, options['bs-host']); that.binaryPath = binaryPath; - childProcess.exec('echo "" > ' + that.logfile); + try { + fs.writeFileSync(that.logfile, ''); + } catch(e) { + console.error('Could not clear log file: ', e.message); + } that.opcode = 'start'; if(!this.binaryPath){ return new LocalError('Couldn\'t find binary file'); @@ -86,7 +90,11 @@ function Local(){ this.getBinaryPath(function(binaryPath){ that.binaryPath = binaryPath; - childProcess.exec('echo "" > ' + that.logfile); + try { + fs.writeFileSync(that.logfile, ''); + } catch(e) { + console.error('Could not clear log file: ', e.message); + } that.opcode = 'start'; that.tunnel = childProcess.execFile(that.binaryPath, that.getBinaryArgs(), function(error, stdout, stderr){