diff options
author | Jake Leahy <jake@leahy.dev> | 2023-11-09 17:33:57 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 07:33:57 +0100 |
commit | 60597adb1019174fe190ff84e46284a72a8b1ae2 (patch) | |
tree | 2224f7dd4effab104d550490de1f82731b57cc08 /compiler | |
parent | e081f565cb658a173c0a3fbe562beda937ed2cc4 (diff) | |
download | Nim-60597adb1019174fe190ff84e46284a72a8b1ae2.tar.gz |
Fix using `--stdout` with `jsondoc` (#22925)
Fixes the assertion defect that happens when using `jsondoc --stdout` (There is no outfile since its just stdout) ``` Error: unhandled exception: options.nim(732, 3) `not conf.outFile.isEmpty` [AssertionDefect] ``` Also makes the output easier to parse by ending each module output with a new line.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/docgen.nim | 2 | ||||
-rw-r--r-- | compiler/msgs.nim | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim index ea7cfad8c..29eeced9b 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -1806,7 +1806,7 @@ proc writeOutputJson*(d: PDoc, useWarning = false) = "moduleDescription": modDesc, "entries": d.jEntriesFinal} if optStdout in d.conf.globalOptions: - write(stdout, $content) + writeLine(stdout, $content) else: let dir = d.destFile.splitFile.dir createDir(dir) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index f69e7733e..5c30acff3 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -725,6 +725,8 @@ proc genSuccessX*(conf: ConfigRef) = elif conf.outFile.isEmpty and conf.cmd notin {cmdJsonscript} + cmdDocLike + cmdBackends: # for some cmd we expect a valid absOutFile output = "unknownOutput" + elif optStdout in conf.globalOptions: + output = "stdout" else: output = $conf.absOutFile if conf.filenameOption != foAbs: output = output.AbsoluteFile.extractFilename |