diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-01 12:38:22 -0500 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-10-02 15:32:08 -0500 |
| commit | 4994e56a3f625995db43f3c31502311192a4c125 (patch) | |
| tree | 2e40cd0f1799b32335116a1a008fd2dd7b431f80 | |
| parent | 86aea481ac3433ddeae7832fc9749f99e12d5f7b (diff) | |
| download | nimterop-4994e56a3f625995db43f3c31502311192a4c125.tar.gz nimterop-4994e56a3f625995db43f3c31502311192a4c125.zip | |
Fix sleep
| -rw-r--r-- | nimterop/build.nim | 13 |
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 ## |
