norgbackup/norg/utils/run.nim

25 lines
497 B
Nim
Raw 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 res = execCmd(cmd)
2024-11-25 12:15:15 +01:00
debug("Run Command Exist Code: " & $res)
return res
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 res = execCmd(cmd)
2024-11-25 12:15:15 +01:00
debug("Run Command Exist Code: " & $res)
return res
except:
2024-08-27 22:16:31 +02:00
error getCurrentExceptionMsg()
return 1