Fix formatting for multi-line command output and delete tasks after completion.
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
import winim, osproc, strutils
|
||||
import winim, osproc, strutils, strformat
|
||||
|
||||
import ../types
|
||||
|
||||
proc taskShell*(command: seq[string]): TaskResult =
|
||||
proc taskShell*(command: seq[string]): tuple[output: TaskResult, status: TaskStatus] =
|
||||
|
||||
echo command.join(" ")
|
||||
let (output, status) = execCmdEx(command.join(" "))
|
||||
|
||||
return output
|
||||
echo "Executing command: ", command.join(" ")
|
||||
|
||||
try:
|
||||
let (output, status) = execCmdEx(command.join(" "))
|
||||
return (output, Completed)
|
||||
|
||||
except CatchableError as err:
|
||||
return (fmt"An error occured: {err.msg}" & "\n", Failed)
|
||||
Reference in New Issue
Block a user