Skip to content

Commit 22073fa

Browse files
committed
fix: dbus signal monitor not returning due to old tail version
Apparently older versions of tail work differently, causing them to never finish Using process substitution we avoid both the temp file and tail alltogether refs: #490
1 parent ac2221a commit 22073fa

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

package/contents/ui/DBusSignalMonitor.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ Item {
5050

5151
function start() {
5252
runCommand.exec(root.monitorCmd, o => {
53-
// exit code 130 indicates received signal from the script
54-
if (o.exitCode === 130) {
53+
if (o.exitCode === 0) {
5554
root.signalReceived(root.getMessage(o.stdout.trim()));
5655
// restart for the next signal
5756
// for some reason it won't restart without a delay???

package/contents/ui/tools/gdbus_get_signal.sh

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ SERVICE=${2}
77
INTERFACE=${3}
88
DBUS_PATH=${4}
99
METHOD=${5}
10-
TMPFILE=$(mktemp)
11-
gdbus monitor --"${BUS_TYPE}" --dest "${SERVICE}" >"$TMPFILE" &
12-
PID=$!
13-
exit_code=130
14-
tail -f "$TMPFILE" | while IFS= read -r line; do
10+
11+
while IFS= read -r line; do
1512
if [[ "$line" == *"${INTERFACE}.${METHOD}"* ]] && [[ "$line" == *"${DBUS_PATH}"* ]]; then
1613
echo "$line"
17-
kill "$PID"
18-
break
14+
exit 0
1915
fi
2016
if [[ "$line" == *"Error"* ]]; then
21-
((exit_code = 1))
22-
kill "$PID"
23-
break
17+
exit 1
2418
fi
25-
done
26-
rm -f "$TMPFILE"
27-
exit "$exit_code"
19+
done < <(gdbus monitor --"${BUS_TYPE}" --dest "${SERVICE}")
20+
21+
exit 1

0 commit comments

Comments
 (0)