Skip to content

Commit 160c37a

Browse files
committed
destroy the readstream properly
1 parent 185bf62 commit 160c37a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

emain/emain-ipc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function saveImageFileWithNativeDialog(
141141
}
142142
const ww = electron.BrowserWindow.fromWebContents(sender);
143143
if (ww == null) {
144+
readStream.destroy();
144145
return;
145146
}
146147
const mimeToExtension: { [key: string]: string } = {
@@ -169,6 +170,7 @@ function saveImageFileWithNativeDialog(
169170
})
170171
.then((file) => {
171172
if (file.canceled) {
173+
readStream.destroy();
172174
return;
173175
}
174176
const writeStream = fs.createWriteStream(file.filePath);

0 commit comments

Comments
 (0)