Skip to content

Commit ee24820

Browse files
committed
use writeFileSync instead of echo to clear the logfile
1 parent 440aa80 commit ee24820

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Local.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ function Local(){
3737

3838
const binaryPath = this.getBinaryPath(null, options['bs-host']);
3939
that.binaryPath = binaryPath;
40-
childProcess.exec('echo "" > ' + that.logfile);
40+
try {
41+
fs.writeFileSync(that.logfile, '');
42+
} catch(e) {
43+
console.error('Could not clear log file: ', e.message);
44+
}
4145
that.opcode = 'start';
4246
if(!this.binaryPath){
4347
return new LocalError('Couldn\'t find binary file');
@@ -86,7 +90,11 @@ function Local(){
8690

8791
this.getBinaryPath(function(binaryPath){
8892
that.binaryPath = binaryPath;
89-
childProcess.exec('echo "" > ' + that.logfile);
93+
try {
94+
fs.writeFileSync(that.logfile, '');
95+
} catch(e) {
96+
console.error('Could not clear log file: ', e.message);
97+
}
9098

9199
that.opcode = 'start';
92100
that.tunnel = childProcess.execFile(that.binaryPath, that.getBinaryArgs(), function(error, stdout, stderr){

0 commit comments

Comments
 (0)