Skip to content

Commit 9cba1c9

Browse files
committed
Fix the issue where the py exe does not close after the application is closed.
1 parent fa6d7b5 commit 9cba1c9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ def steps(data):
215215
data = json.loads(input_data)
216216
print_with_flush(data)
217217

218+
if data['operation'] == 'close':
219+
break
220+
218221
if data['operation'] == 'generate':
219222
file_extension = data['filePath'].split(".")[1]
220223
if file_extension == 'json':

main.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ app.whenReady().then(() => {
133133
});
134134
});
135135

136-
app.on('quit', () => {
137-
if (pythonProcess) {
138-
pythonProcess.kill();
139-
}
136+
app.on('will-quit', () => {
137+
pythonProcess.stdin.write('{"operation": "close"}' + '\n');
140138
});

0 commit comments

Comments
 (0)