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