I expiremented a bit, and my conclusion is, that using the `regex` library in
Nimscript will always work, except you are invoking `nimscript`'s `exec` proc.
(Or any other proc using `nimscript`'s `log` template.) If that `exec` proc
wouldn't use `nimscript`'s `log` template, then it would all work.
`exec`
proc exec*(command: string) {.
raises: [OSError], tags: [ExecIOEffect, WriteIOEffect].} =
## Executes an external process. If the external process terminates with
## a non-zero exit code, an OSError exception is raised.
##
## **Note:** If you need a version of `exec` that returns the exit code
## and text output of the command, you can use `system.gorgeEx
## <system.html#gorgeEx,string,string,string>`_.
log "exec: " & command:
if rawExec(command) != 0:
raise newException(OSError, "FAILED: " & command)
checkOsError()
Run
`log`
template log(msg: string, body: untyped) =
if mode in {ScriptMode.Verbose, ScriptMode.Whatif}:
echo "[NimScript] ", msg
if mode != ScriptMode.Whatif:
body
Run
`mode`
var
mode*: ScriptMode ## Set this to influence how mkDir, rmDir, rmFile etc.
## behave
Run