Skip to content

Commit b118e25

Browse files
authored
(fix) pass --colors:off to Nim compiler properly (#1164)
1 parent 2d93b46 commit b118e25

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/nimble.nim

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ proc buildFromDir(pkgInfo: PackageInfo, paths: HashSet[string],
193193
if options.verbosity == SilentPriority:
194194
# Hide Nim warnings
195195
args.add("--warnings:off")
196+
if options.noColor:
197+
# Disable coloured output
198+
args.add("--colors:off")
196199

197200
let binToBuild =
198201
# Only build binaries specified by user if any, but only if top-level package,
@@ -225,8 +228,8 @@ proc buildFromDir(pkgInfo: PackageInfo, paths: HashSet[string],
225228
let input = realDir / src.changeFileExt("nim")
226229
# `quoteShell` would be more robust than `\"` (and avoid quoting when
227230
# un-necessary) but would require changing `extractBin`
228-
let cmd = "$# $# --colors:on --noNimblePath $# $# $#" % [
229-
pkgInfo.getNimBin(options).quoteShell, pkgInfo.backend, join(args, " "),
231+
let cmd = "$# $# --colors:$# --noNimblePath $# $# $#" % [
232+
pkgInfo.getNimBin(options).quoteShell, pkgInfo.backend, if options.noColor: "off" else: "on", join(args, " "),
230233
outputOpt, input.quoteShell]
231234
try:
232235
doCmd(cmd)

0 commit comments

Comments
 (0)