From af3bff6382fe4c1ca97e1f8ce1a93ed37308e387 Mon Sep 17 00:00:00 2001 From: Gioele Barabucci Date: Thu, 17 Feb 2022 12:34:41 +0100 Subject: mini-dinstall: Log mkdir errors instead of just printing them The use of `print` to report errors occurred during the creation of directories does not leave any trace in the logs, making post-facto analysis of failures much harder. Let's instead use the same logging mechanism used for other errors. --- mini-dinstall | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mini-dinstall b/mini-dinstall index e6e1225..218365c 100755 --- a/mini-dinstall +++ b/mini-dinstall @@ -185,10 +185,11 @@ def do_and_log(msg, function, *args): def do_mkdir(name): if os.access(name, os.X_OK): return + try: do_and_log('Creating directory "%s"' % name, os.mkdir, name) except OSError as e: - print(e) + logger.error(e) exit(1) def do_rename(source, target): -- cgit v1.2.3