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 # Package
version = "0.1.12" version = "0.1.13"
author = "Paul Wilde" author = "Paul Wilde"
description = "A Borg Backup Orchestration Tool" description = "A Borg Backup Orchestration Tool"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"

View file

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