switch to use execCmdEX for hopefully better logging

This commit is contained in:
Paul Wilde 2024-11-25 11:41:33 +00:00
parent 2aeb2bd4a4
commit 160cf2a534
2 changed files with 9 additions and 7 deletions

View file

@ -1,6 +1,6 @@
# Package
version = "0.1.12"
version = "0.1.13"
author = "Paul Wilde"
description = "A Borg Backup Orchestration Tool"
license = "AGPL-3.0-or-later"

View file

@ -5,9 +5,10 @@ import ../model/log_type
proc run*(cmd: string): int =
debug fmt"Trying to run : {cmd}"
try:
let res = execCmd(cmd)
debug("Run Command Exist Code: " & $res)
return res
let (output,exitcode) = execCmdEx(cmd)
debug("Run Command Exist Code: " & $exitcode)
info(output)
return exitcode
except:
error getCurrentExceptionMsg()
return 1
@ -15,9 +16,10 @@ proc run*(cmd: string): int =
proc runDiscard*(cmd: string): int =
debug fmt"Trying to run : {cmd}"
try:
let res = execCmd(cmd)
debug("Run Command Exist Code: " & $res)
return res
let (output,exitcode) = execCmdEx(cmd)
debug("Run Command Exist Code: " & $exitcode)
info(output)
return exitcode
except:
error getCurrentExceptionMsg()
return 1