2024-08-23 10:50:53 +02:00
|
|
|
import strformat
|
|
|
|
import osproc
|
2024-08-27 22:39:21 +02:00
|
|
|
import ../model/log_type
|
2024-08-23 10:50:53 +02:00
|
|
|
|
|
|
|
proc run*(cmd: string): int =
|
2024-08-27 22:16:31 +02:00
|
|
|
debug fmt"Trying to run : {cmd}"
|
2024-08-23 10:50:53 +02:00
|
|
|
try:
|
2024-11-25 12:41:33 +01:00
|
|
|
let (output,exitcode) = execCmdEx(cmd)
|
|
|
|
debug("Run Command Exist Code: " & $exitcode)
|
|
|
|
info(output)
|
|
|
|
return exitcode
|
2024-08-23 10:50:53 +02:00
|
|
|
except:
|
2024-08-27 22:16:31 +02:00
|
|
|
error getCurrentExceptionMsg()
|
2024-08-23 10:50:53 +02:00
|
|
|
return 1
|
|
|
|
|
|
|
|
proc runDiscard*(cmd: string): int =
|
2024-08-27 22:16:31 +02:00
|
|
|
debug fmt"Trying to run : {cmd}"
|
2024-08-23 10:50:53 +02:00
|
|
|
try:
|
2024-11-25 12:41:33 +01:00
|
|
|
let (output,exitcode) = execCmdEx(cmd)
|
|
|
|
debug("Run Command Exist Code: " & $exitcode)
|
|
|
|
info(output)
|
|
|
|
return exitcode
|
2024-08-23 10:50:53 +02:00
|
|
|
except:
|
2024-08-27 22:16:31 +02:00
|
|
|
error getCurrentExceptionMsg()
|
2024-08-23 10:50:53 +02:00
|
|
|
return 1
|
2024-08-23 15:08:14 +02:00
|
|
|
|