Skip to content

Commit 6c4c65d

Browse files
authored
bluetooth-battery@zamszowy: Don't indicate error when no updates (#8207)
* When there are no updates pending, pkcon exits with code '5' - we should not treat is as an error.
1 parent 0b2b091 commit 6c4c65d

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

updates-notifier@zamszowy/files/updates-notifier@zamszowy/applet.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,14 +381,16 @@ UpdatesNotifier.prototype = {
381381
// accept updates changes only when originating from this applet
382382
this.checkingInProgress = true;
383383
Util.spawn_async(['/usr/bin/bash', this.applet_path + '/updates.sh', "check", refreshMode], (stdout) => {
384+
this.lastRefreshTime = GLib.get_monotonic_time();
385+
384386
if (stdout !== '') {
385387
this.checkingInProgress = false;
386388
global.logError(`${UUID}: pkcon get-updates failed`);
387389
this.hasError = true;
388390
this._update();
391+
return;
389392
}
390393

391-
this.lastRefreshTime = GLib.get_monotonic_time();
392394
if (this.showFirmware) {
393395
let fwCount = 0;
394396
for (let line of stdout.trim().split("\n")) {

updates-notifier@zamszowy/files/updates-notifier@zamszowy/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"uuid": "updates-notifier@zamszowy",
33
"name": "Updates notifier",
44
"description": "Shows icons for pending update packages",
5-
"version": "2.3.0"
5+
"version": "2.3.1"
66
}

updates-notifier@zamszowy/files/updates-notifier@zamszowy/updates.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ check)
1313
pkcon refresh &>/dev/null
1414
fi
1515

16-
if ! out=$(pkcon get-updates 2>&1); then
16+
out=$(pkcon get-updates 2>&1)
17+
exit_code=$?
18+
if [[ $exit_code -ne 0 ]] && [[ $exit_code -ne 5 ]]; then
1719
echo ERROR
1820
echo "$out" > "$DIR/error"
1921
exit 0

0 commit comments

Comments
 (0)