Implemented sleep command to update sleep delay on agent
This commit is contained in:
14
agents/monarch/commands/sleep.nim
Normal file
14
agents/monarch/commands/sleep.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
import os, strutils, strformat
|
||||
|
||||
import ../types
|
||||
|
||||
proc taskSleep*(delay: int): tuple[output: TaskResult, status: TaskStatus] =
|
||||
|
||||
echo fmt"Sleeping for {$delay} seconds."
|
||||
|
||||
try:
|
||||
sleep(delay * 1000)
|
||||
return ("\n", Completed)
|
||||
|
||||
except CatchableError as err:
|
||||
return (fmt"An error occured: {err.msg}" & "\n", Failed)
|
||||
Reference in New Issue
Block a user