mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] check if log exists before tailing to avoid errors
This commit is contained in:
parent
911a4ec507
commit
3a6f3c3732
1 changed files with 2 additions and 2 deletions
|
@ -298,7 +298,7 @@ def service_log(name, number=50):
|
|||
for log_path in log_list:
|
||||
# log is a file, read it
|
||||
if not os.path.isdir(log_path):
|
||||
result[log_path] = _tail(log_path, int(number))
|
||||
result[log_path] = _tail(log_path, int(number)) if os.path.exists(log_path) else []
|
||||
continue
|
||||
|
||||
for log_file in os.listdir(log_path):
|
||||
|
@ -310,7 +310,7 @@ def service_log(name, number=50):
|
|||
if not log_file.endswith(".log"):
|
||||
continue
|
||||
|
||||
result[log_file_path] = _tail(log_file_path, int(number))
|
||||
result[log_file_path] = _tail(log_file_path, int(number)) if os.path.exists(log_file_path) else []
|
||||
|
||||
return result
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue