[dconf: 2/3] bin: Indicate update failure with non-zero exit code



commit dfa40d895fa5ad44ce34c80ddc5d5eb87080890b
Author: Tomasz Miąsko <tomasz miasko gmail com>
Date:   Thu Nov 15 00:00:00 2018 +0000

    bin: Indicate update failure with non-zero exit code
    
    Fixes issue #42.

 bin/dconf-update.vala | 7 +++++++
 tests/test-dconf.py   | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala
index b4e0132..9492adb 100644
--- a/bin/dconf-update.vala
+++ b/bin/dconf-update.vala
@@ -235,15 +235,22 @@ void maybe_update_from_directory (string dirname) throws GLib.Error {
 }
 
 void update_all (string dirname) throws GLib.Error {
+       var failed = false;
+
        foreach (var name in list_directory (dirname, Posix.S_IFDIR)) {
                if (name.has_suffix (".d")) {
                        try {
                                maybe_update_from_directory (name);
                        } catch (Error e) {
+                               failed = true;
                                printerr ("unable to compile %s: %s\n", name, e.message);
                        }
                }
        }
+
+       if (failed) {
+               Process.exit (2);
+       }
 }
 
 void dconf_compile (string[] args) throws GLib.Error {
diff --git a/tests/test-dconf.py b/tests/test-dconf.py
index 202dc9f..40a8737 100755
--- a/tests/test-dconf.py
+++ b/tests/test-dconf.py
@@ -599,7 +599,6 @@ class DBusTest(unittest.TestCase):
                 # Now database should be marked as invalid.
                 self.assertEqual(b'\0'*8, mm[:8])
 
-    @unittest.expectedFailure
     def test_update_failure(self):
         """Update should skip invalid configuration directory and continue with
         others. Failure to update one of databases should be indicated with


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]