gnunet-svn
[Top][All Lists]
Advanced

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

[taler-deployment] branch master updated: taler-local: fix logging


From: gnunet
Subject: [taler-deployment] branch master updated: taler-local: fix logging
Date: Thu, 13 Jan 2022 10:14:36 +0100

This is an automated email from the git hooks/post-receive script.

ms pushed a commit to branch master
in repository deployment.

The following commit(s) were added to refs/heads/master by this push:
     new 60d32ed  taler-local: fix logging
60d32ed is described below

commit 60d32ed5f36dd478e7e91118d66acc9e4d2e2392
Author: ms <ms@taler.net>
AuthorDate: Thu Jan 13 10:14:28 2022 +0100

    taler-local: fix logging
---
 bin/WIP/taler-local | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/bin/WIP/taler-local b/bin/WIP/taler-local
index 76b9ffe..89ea0ad 100755
--- a/bin/WIP/taler-local
+++ b/bin/WIP/taler-local
@@ -31,7 +31,7 @@ import random
 import logging
 import json
 from os import listdir
-from os.path import isdir, join
+from os.path import isdir, join, basename
 from pathlib import Path
 from typing import List, Callable
 from shutil import copy
@@ -493,7 +493,6 @@ def prepare(x_forwarded_host, x_forwarded_proto, 
postgres_db_name):
     def fail(reason=None):
         if reason:
             print("ERROR:", reason)
-            print(f"Logs in {LOG_DIR}")
         exit(1)
     
     def kill(proc):
@@ -762,7 +761,7 @@ def prepare(x_forwarded_host, x_forwarded_proto, 
postgres_db_name):
             ):
             if len(cmd) == 0:
                 fail("Command to execute was given empty.")
-            self.name = custom_name if custom_name else cmd[0]
+            self.name = custom_name if custom_name else basename(cmd[0])
             self.cmd = cmd
             self.capture_stdout = capture_stdout
             self.log_dir = log_dir
@@ -771,9 +770,9 @@ def prepare(x_forwarded_host, x_forwarded_proto, 
postgres_db_name):
         def run(self):
             self.do()
             return_code = self.handle.wait()
+            self.cleanup() # Mainly closes the log file.
             if return_code != 0:
                 fail(f"Command {self.name} failed. Logs in {self.log_dir}")
-            self.cleanup()
             if self.capture_stdout:
                 return self.handle.communicate()[0].decode("utf-8").rstrip()
 
@@ -781,9 +780,8 @@ def prepare(x_forwarded_host, x_forwarded_proto, 
postgres_db_name):
             return self.log_file.name
 
         def cleanup(self):
-            if not self.log_file.closed:
-                self.log_file.flush()
-                self.log_file.close()
+            self.log_file.flush()
+            self.log_file.close()
 
         def do(self):
             if not self.log_dir.is_dir():

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]