Output from Nimble scripts' top-level statements is now
only visible with --verbose.
This commit is contained in:
Dominik Picheta 2019-09-22 14:39:22 +01:00
commit 281a1d129a
4 changed files with 44 additions and 1 deletions

View file

@ -30,6 +30,12 @@ proc needsLiveOutput(actionName: string, options: Options, isHook: bool): bool =
let isCustomTask = isCustomTask(actionName, options)
return isCustomTask or isHook or actionName == ""
proc writeExecutionOutput(data: string) =
# TODO: in the future we will likely want this to be live, users will
# undoubtedly be doing loops and other crazy things in their top-level
# Nimble files.
display("Info", data)
proc execNimscript(
nimsFile, projectDir, actionName: string, options: Options, isHook: bool
): tuple[output: string, exitCode: int, stdout: string] =
@ -135,6 +141,7 @@ proc getIniFile*(scriptName: string, options: Options): string =
if exitCode == 0 and output.len != 0:
result.writeFile(output)
stdout.writeExecutionOutput()
else:
raise newException(NimbleError, stdout & "\nprintPkgInfo() failed")
@ -175,6 +182,8 @@ proc execScript(
result.flags[flag].add val.getStr()
result.retVal = j{"retVal"}.getBool()
stdout.writeExecutionOutput()
proc execTask*(scriptName, taskName: string,
options: Options): ExecutionResult[bool] =
## Executes the specified task in the specified script.