show cmd used with --verbose (even on success); fix #783 (#781)

* show cmd used with --verbose (even on success)

* honor -p:-u:release

* address comment

* remove --showCmds flag

* remove quoteShell

* fix #783

* Revert "fix #783"

This reverts commit af0ac004c00f17e9983c63ab99e40cd38ba6aaa4.

* fix #783 by fixing the gist instead

* Revert "fix #783 by fixing the gist instead" now that upstream gist was updated with my patch

This reverts commit 8bec86039d8335af152acf238ab14d0268e003e5.
This commit is contained in:
Timothee Cour 2020-03-26 16:14:09 -07:00 committed by GitHub
commit a10691bdf2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View file

@ -251,10 +251,14 @@ proc buildFromDir(
if not existsDir(outputDir): if not existsDir(outputDir):
createDir(outputDir) createDir(outputDir)
let input = realDir / bin.changeFileExt("nim")
# `quoteShell` would be more robust than `\"` (and avoid quoting when
# un-necessary) but would require changing `extractBin`
let cmd = "\"$#\" $# --noNimblePath $# $# $# \"$#\"" %
[getNimBin(), pkgInfo.backend, nimblePkgVersion,
join(args, " "), outputOpt, input]
try: try:
doCmd("\"" & getNimBin() & "\" $# --noNimblePath $# $# $# \"$#\"" % doCmd(cmd, showCmd = true)
[pkgInfo.backend, nimblePkgVersion, join(args, " "), outputOpt,
realDir / bin.changeFileExt("nim")])
binariesBuilt.inc() binariesBuilt.inc()
except NimbleError: except NimbleError:
let currentExc = (ref NimbleError)(getCurrentException()) let currentExc = (ref NimbleError)(getCurrentException())
@ -382,7 +386,7 @@ proc installFromDir(dir: string, requestedVer: VersionRange, options: Options,
options.action.passNimFlags options.action.passNimFlags
else: else:
@[] @[]
buildFromDir(pkgInfo, paths, flags & "-d:release", options) buildFromDir(pkgInfo, paths, "-d:release" & flags, options)
let pkgDestDir = pkgInfo.getPkgDest(options) let pkgDestDir = pkgInfo.getPkgDest(options)
if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"): if existsDir(pkgDestDir) and existsFile(pkgDestDir / "nimblemeta.json"):

View file

@ -11,7 +11,7 @@ proc extractBin(cmd: string): string =
else: else:
return cmd.split(' ')[0] return cmd.split(' ')[0]
proc doCmd*(cmd: string, showOutput = false) = proc doCmd*(cmd: string, showOutput = false, showCmd = false) =
let bin = extractBin(cmd) let bin = extractBin(cmd)
if findExe(bin) == "": if findExe(bin) == "":
raise newException(NimbleError, "'" & bin & "' not in PATH.") raise newException(NimbleError, "'" & bin & "' not in PATH.")
@ -20,7 +20,10 @@ proc doCmd*(cmd: string, showOutput = false) =
stdout.flushFile() stdout.flushFile()
stderr.flushFile() stderr.flushFile()
displayDebug("Executing", cmd) if showCmd:
display("Executing", cmd, priority = MediumPriority)
else:
displayDebug("Executing", cmd)
if showOutput: if showOutput:
let exitCode = execCmd(cmd) let exitCode = execCmd(cmd)
displayDebug("Finished", "with exit code " & $exitCode) displayDebug("Finished", "with exit code " & $exitCode)