Skip to content

Commit 4f04533

Browse files
authored
HTTP Server: Fix CSV deletion (#530)
1 parent d3165a1 commit 4f04533

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/service/http-server.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,17 @@ export class HttpServer {
296296
} else {
297297
try {
298298
this.log.debug('Deleting temporary file', 'file', result.filePath);
299-
fs.unlinkSync(result.filePath);
300-
if (!options.filePath) {
301-
fs.rmdirSync(path.dirname(result.filePath));
302-
}
299+
fs.unlink(result.filePath, (err) => {
300+
if (err) {
301+
throw err
302+
}
303+
304+
if (!options.filePath) {
305+
fs.rmdir(path.dirname(result.filePath), () => {});
306+
}
307+
})
303308
} catch (e) {
304-
this.log.error('Failed to delete temporary file', 'file', result.filePath);
309+
this.log.error('Failed to delete temporary file', 'file', result.filePath, 'error', e.message);
305310
}
306311
}
307312
});

0 commit comments

Comments
 (0)