aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-10-18 03:53:28 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-10-19 03:02:14 -0300
commit863585842993f8a64c782254e011bb268a452d4e (patch)
treeda0b504cc8afa23b14c0101a56b8dbd3481bdc23 /contrib
parentsort.py: line-wrap and improve comments (diff)
downloadfirejail-863585842993f8a64c782254e011bb268a452d4e.tar.gz
firejail-863585842993f8a64c782254e011bb268a452d4e.tar.zst
firejail-863585842993f8a64c782254e011bb268a452d4e.zip
sort.py: print errors to stderr
Misc: The trailing comma is due to using the opinionated `black` Python formatter (which seems to be a relatively common one). This was the only change made, so the code seems to already be following the format used by this tool.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/sort.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/contrib/sort.py b/contrib/sort.py
index b4e06d345..595ad0536 100755
--- a/contrib/sort.py
+++ b/contrib/sort.py
@@ -30,7 +30,7 @@ Exit Codes:
30 30
31# Requirements: 31# Requirements:
32# python >= 3.6 32# python >= 3.6
33from sys import argv, exit as sys_exit 33from sys import argv, exit as sys_exit, stderr
34 34
35 35
36def sort_alphabetical(original_items): 36def sort_alphabetical(original_items):
@@ -103,13 +103,16 @@ def main(args):
103 else: 103 else:
104 fix_profile(filename) 104 fix_profile(filename)
105 except FileNotFoundError: 105 except FileNotFoundError:
106 print(f"[ Error ] Can't find `{filename}'") 106 print(f"[ Error ] Can't find `{filename}'", file=stderr)
107 exit_code = 1 107 exit_code = 1
108 except PermissionError: 108 except PermissionError:
109 print(f"[ Error ] Can't read/write `{filename}'") 109 print(f"[ Error ] Can't read/write `{filename}'", file=stderr)
110 exit_code = 1 110 exit_code = 1
111 except Exception as err: 111 except Exception as err:
112 print(f"[ Error ] An error occurred while processing `{filename}': {err}") 112 print(
113 f"[ Error ] An error occurred while processing `{filename}': {err}",
114 file=stderr,
115 )
113 exit_code = 1 116 exit_code = 1
114 return exit_code 117 return exit_code
115 118