From 4994e56a3f625995db43f3c31502311192a4c125 Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Tue, 1 Oct 2019 12:38:22 -0500 Subject: [PATCH] Fix sleep --- nimterop/build.nim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nimterop/build.nim b/nimterop/build.nim index e36324a..a3dd95f 100644 --- a/nimterop/build.nim +++ b/nimterop/build.nim @@ -1,6 +1,6 @@ import macros, osproc, regex, strformat, strutils, tables -import os except findExe +import os except findExe, sleep import "."/[compat] @@ -9,6 +9,17 @@ proc sanitizePath*(path: string, noQuote = false, sep = $DirSep): string = if not noQuote: result = result.quoteShell +proc sleep*(milsecs: int) = + ## Sleep at compile time + let + cmd = + when defined(windows): + "cmd /c timeout " + else: + "sleep " + + (oup, ret) = gorgeEx(cmd & $(milsecs / 1000)) + proc execAction*(cmd: string, retry = 0, nostderr = false): string = ## Execute an external command - supported at compile time ##