mirror of
https://github.com/daylinmorgan/oizys.git
synced 2025-02-23 07:55:50 -06:00
if print-build-logs then print the build logs
This commit is contained in:
parent
00c648780d
commit
e94bd64891
1 changed files with 10 additions and 9 deletions
|
@ -316,11 +316,6 @@ type
|
||||||
BuildResult = object
|
BuildResult = object
|
||||||
duration*: Duration
|
duration*: Duration
|
||||||
successful*: bool
|
successful*: bool
|
||||||
stdout*: string
|
|
||||||
stderr*: string
|
|
||||||
|
|
||||||
proc show(br: BuildResult) =
|
|
||||||
error "\n" & formatStdoutStderr(br.stdout, br.stderr)
|
|
||||||
|
|
||||||
func formatDuration(d: Duration): string =
|
func formatDuration(d: Duration): string =
|
||||||
## convert duration to: X minutes and Y seconds
|
## convert duration to: X minutes and Y seconds
|
||||||
|
@ -336,16 +331,22 @@ proc build(path: string, drv: NixDerivation, rest: seq[string]): BuildResult =
|
||||||
var cmd = "nix build"
|
var cmd = "nix build"
|
||||||
cmd.addArgs path & "^*", "--no-link"
|
cmd.addArgs path & "^*", "--no-link"
|
||||||
cmd.addArgs rest
|
cmd.addArgs rest
|
||||||
let (stdout, stderr, buildCode) = runCmdCapt(cmd, {CaptStderr})
|
|
||||||
|
let (stdout, stderr, buildCode) =
|
||||||
|
if "-L" in rest or "--print-build-logs" in rest: ("","", runCmd(cmd))
|
||||||
|
else: runCmdCapt(cmd, {CaptStderr})
|
||||||
|
|
||||||
result.duration = now() - startTime
|
result.duration = now() - startTime
|
||||||
result.stdout = stdout
|
|
||||||
result.stderr = stderr
|
# result.stdout = stdout
|
||||||
|
# result.stderr = stderr
|
||||||
if buildCode == 0:
|
if buildCode == 0:
|
||||||
result.successful = true
|
result.successful = true
|
||||||
info "succesfully built: " & splitDrv(path).name
|
info "succesfully built: " & splitDrv(path).name
|
||||||
else:
|
else:
|
||||||
error "failed to build: " & splitDrv(path).name
|
error "failed to build: " & splitDrv(path).name
|
||||||
show result
|
error "\n" & formatStdoutStderr(stdout, stderr)
|
||||||
|
|
||||||
info "-> duration: " & formatDuration(result.duration)
|
info "-> duration: " & formatDuration(result.duration)
|
||||||
|
|
||||||
func outputsPaths(drv: NixDerivation): seq[string] =
|
func outputsPaths(drv: NixDerivation): seq[string] =
|
||||||
|
|
Loading…
Add table
Reference in a new issue