mirror of
https://github.com/daylinmorgan/oizys.git
synced 2024-12-24 03:40:44 -06:00
Compare commits
2 commits
b020fe0230
...
add7992106
Author | SHA1 | Date | |
---|---|---|---|
add7992106 | |||
5e7dce62cb |
2 changed files with 19 additions and 5 deletions
|
@ -19,11 +19,23 @@ proc runCmd*(cmd: string): int =
|
||||||
proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
|
proc runCmdCapt*(cmd: string): tuple[stdout, stderr: string, exitCode: int] =
|
||||||
let args = cmd.splitWhitespace()
|
let args = cmd.splitWhitespace()
|
||||||
let p = startProcess(args[0], args = args[1..^1], options = {poUsePath})
|
let p = startProcess(args[0], args = args[1..^1], options = {poUsePath})
|
||||||
result = (
|
let ostrm = outputStream p
|
||||||
readAll p.outputStream,
|
let errstrm = errorStream p
|
||||||
readAll p.errorStream,
|
result.exitCode = -1
|
||||||
waitForExit p
|
var line = newStringOfCap(120)
|
||||||
)
|
while true:
|
||||||
|
if ostrm.readLine(line):
|
||||||
|
result.stdout.add line & '\n'
|
||||||
|
if errstrm.readLine(line):
|
||||||
|
result.stderr.add line & '\n'
|
||||||
|
result.exitCode = peekExitCode(p)
|
||||||
|
if result.exitCode != -1: break
|
||||||
|
|
||||||
|
# result = (
|
||||||
|
# readAll p.outputStream,
|
||||||
|
# readAll p.errorStream,
|
||||||
|
# waitForExit p
|
||||||
|
# )
|
||||||
close p
|
close p
|
||||||
|
|
||||||
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =
|
proc runCmdCaptWithSpinner*(cmd: string, msg: string = ""): tuple[output, err: string] =
|
||||||
|
|
|
@ -110,6 +110,8 @@ proc toBuildNixosConfiguration(): seq[string] =
|
||||||
var cmd = nixCommand("build")
|
var cmd = nixCommand("build")
|
||||||
cmd.addArg "--dry-run"
|
cmd.addArg "--dry-run"
|
||||||
cmd.addArgs nixosConfigAttrs()
|
cmd.addArgs nixosConfigAttrs()
|
||||||
|
debug "trying with ouptut"
|
||||||
|
discard execCmd(cmd)
|
||||||
let (_, err) = runCmdCaptWithSpinner(cmd, "running dry run build for: " & getHosts().join(" "))
|
let (_, err) = runCmdCaptWithSpinner(cmd, "running dry run build for: " & getHosts().join(" "))
|
||||||
let output = parseDryRunOutput err
|
let output = parseDryRunOutput err
|
||||||
return output.toBuild.mapIt(it.storePath)
|
return output.toBuild.mapIt(it.storePath)
|
||||||
|
|
Loading…
Reference in a new issue