Output from Nimble scripts' top-level statements is now only visible with --verbose.
This commit is contained in:
parent
a703de5dbd
commit
281a1d129a
4 changed files with 44 additions and 1 deletions
|
|
@ -30,6 +30,12 @@ proc needsLiveOutput(actionName: string, options: Options, isHook: bool): bool =
|
||||||
let isCustomTask = isCustomTask(actionName, options)
|
let isCustomTask = isCustomTask(actionName, options)
|
||||||
return isCustomTask or isHook or actionName == ""
|
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(
|
proc execNimscript(
|
||||||
nimsFile, projectDir, actionName: string, options: Options, isHook: bool
|
nimsFile, projectDir, actionName: string, options: Options, isHook: bool
|
||||||
): tuple[output: string, exitCode: int, stdout: string] =
|
): 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:
|
if exitCode == 0 and output.len != 0:
|
||||||
result.writeFile(output)
|
result.writeFile(output)
|
||||||
|
stdout.writeExecutionOutput()
|
||||||
else:
|
else:
|
||||||
raise newException(NimbleError, stdout & "\nprintPkgInfo() failed")
|
raise newException(NimbleError, stdout & "\nprintPkgInfo() failed")
|
||||||
|
|
||||||
|
|
@ -175,6 +182,8 @@ proc execScript(
|
||||||
result.flags[flag].add val.getStr()
|
result.flags[flag].add val.getStr()
|
||||||
result.retVal = j{"retVal"}.getBool()
|
result.retVal = j{"retVal"}.getBool()
|
||||||
|
|
||||||
|
stdout.writeExecutionOutput()
|
||||||
|
|
||||||
proc execTask*(scriptName, taskName: string,
|
proc execTask*(scriptName, taskName: string,
|
||||||
options: Options): ExecutionResult[bool] =
|
options: Options): ExecutionResult[bool] =
|
||||||
## Executes the specified task in the specified script.
|
## Executes the specified task in the specified script.
|
||||||
|
|
|
||||||
17
tests/issue708/issue708.nimble
Normal file
17
tests/issue708/issue708.nimble
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Package
|
||||||
|
|
||||||
|
version = "0.1.0"
|
||||||
|
author = "Dominik Picheta"
|
||||||
|
description = "A new awesome nimble package"
|
||||||
|
license = "MIT"
|
||||||
|
srcDir = "src"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
|
|
||||||
|
requires "nim >= 0.16.0"
|
||||||
|
|
||||||
|
|
||||||
|
echo "hello"
|
||||||
|
echo "hello2"
|
||||||
7
tests/issue708/src/issue708.nim
Normal file
7
tests/issue708/src/issue708.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# This is just an example to get you started. A typical library package
|
||||||
|
# exports the main API in this file. Note that you cannot rename this file
|
||||||
|
# but you can remove it if you wish.
|
||||||
|
|
||||||
|
proc add*(x, y: int): int =
|
||||||
|
## Adds two files together.
|
||||||
|
return x + y
|
||||||
|
|
@ -79,9 +79,19 @@ proc hasLineStartingWith(lines: seq[string], prefix: string): bool =
|
||||||
return true
|
return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
test "issue 708":
|
||||||
|
cd "issue708":
|
||||||
|
# TODO: We need a way to filter out compiler messages from the messages
|
||||||
|
# written by our nimble scripts.
|
||||||
|
var (output, exitCode) = execNimble("install", "-y", "--verbose")
|
||||||
|
check exitCode == QuitSuccess
|
||||||
|
let lines = output.strip.processOutput()
|
||||||
|
check(inLines(lines, "hello"))
|
||||||
|
check(inLines(lines, "hello2"))
|
||||||
|
|
||||||
test "issue 564":
|
test "issue 564":
|
||||||
cd "issue564":
|
cd "issue564":
|
||||||
var (output, exitCode) = execNimble("build")
|
var (_, exitCode) = execNimble("build")
|
||||||
check exitCode == QuitSuccess
|
check exitCode == QuitSuccess
|
||||||
|
|
||||||
test "depsOnly + flag order test":
|
test "depsOnly + flag order test":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue