norgbackup/norg/utils/run.nim

27 lines
583 B
Nim
Raw Permalink Normal View History

import strformat
import osproc
import ../model/log_type
proc run*(cmd: string): int =
2024-08-27 22:16:31 +02:00
debug fmt"Trying to run : {cmd}"
try:
let (output,exitcode) = execCmdEx(cmd)
debug("Run Command Exist Code: " & $exitcode)
info(output)
return exitcode
except:
2024-08-27 22:16:31 +02:00
error getCurrentExceptionMsg()
return 1
proc runDiscard*(cmd: string): int =
2024-08-27 22:16:31 +02:00
debug fmt"Trying to run : {cmd}"
try:
let (output,exitcode) = execCmdEx(cmd)
debug("Run Command Exist Code: " & $exitcode)
info(output)
return exitcode
except:
2024-08-27 22:16:31 +02:00
error getCurrentExceptionMsg()
return 1