Skip to content

Commit d080a25

Browse files
tdusnokiyichoi
authored andcommitted
Filter empty source code files in handleSource function (#44)
IoT.js-Debug-DCO-1.0-Signed-off-by: Tibor Dusnoki [email protected]
1 parent af95188 commit d080a25

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/IotjsDebugger.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -428,22 +428,24 @@ class IotjsDebugSession extends DebugSession {
428428
// General helper functions
429429

430430
private handleSource(data: JerryMessageScriptParsed): void {
431-
const path = Path.join(`${this._args.localRoot}`, `${this.pathToBasename(data.name)}`);
432431
const src = this._protocolhandler.getSource(data.id);
432+
if (src !== '') {
433+
const path = Path.join(`${this._args.localRoot}`, `${this.pathToBasename(data.name)}`);
433434

434-
const write = c => Fs.writeSync(Fs.openSync(path, 'w'), c);
435+
const write = c => Fs.writeSync(Fs.openSync(path, 'w'), c);
435436

436-
if (Fs.existsSync(path)) {
437-
const content = Fs.readFileSync(path, {
438-
encoding: 'utf8',
439-
flag: 'r'
440-
});
437+
if (Fs.existsSync(path)) {
438+
const content = Fs.readFileSync(path, {
439+
encoding: 'utf8',
440+
flag: 'r'
441+
});
441442

442-
if (content !== src) {
443+
if (content !== src) {
444+
write(src);
445+
}
446+
} else {
443447
write(src);
444448
}
445-
} else {
446-
write(src);
447449
}
448450
}
449451

0 commit comments

Comments
 (0)