aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nimterop/build.nim13
1 files changed, 12 insertions, 1 deletions
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
##