Skip to content

Commit 7aaa2ff

Browse files
committed
Add exit code to exit notification.
1 parent 1d0d8d2 commit 7aaa2ff

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Automatically quit if the interior application exits.
5151
Notifications
5252
-------------
5353

54-
*exited
54+
*exited:[code]
5555

56-
The application has exited.
56+
The application has exited with exit code [code].
5757

5858
*bell
5959

main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ class Main {
109109
controlData(buff, num);
110110
});
111111

112-
QObject::connect(&process, qOverload<int>(&QProcess::finished), [this] {
113-
const char msg[] = "*exited";
114-
write(controlFd, msg, sizeof(msg));
112+
QObject::connect(&process, qOverload<int>(&QProcess::finished), [this](int code) {
113+
const QByteArray msg = QString("*exited:%0").arg(code).toUtf8();
114+
write(controlFd, msg.data(), msg.size() + 1);
115115
if (autoQuit) {
116116
QCoreApplication::instance()->quit();
117117
}

test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def run_in_terminal(args, *, cmds=[]):
4444
if message and message[0] == ord('{'):
4545
result = json.loads(message.decode())
4646
outer.send(b'quit\0')
47-
elif message == b'*exited':
47+
elif message.startswith(b'*exited:'):
4848
outer.send(b'capture:all\0')
4949
elif message.startswith(b'*'):
5050
notifications.append(message.decode())

0 commit comments

Comments
 (0)