refs #14545 fix snippet errors: avoid showing confusing errors when they are expected (#14569)

This commit is contained in:
Timothee Cour 2020-06-05 19:04:39 -07:00 • committed by GitHub
commit 7cdf470269
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ import
packages/docutils/rst, packages/docutils/rstgen, packages/docutils/rst, packages/docutils/rstgen,
json, xmltree, cgi, trees, types, json, xmltree, cgi, trees, types,
typesrenderer, astalgo, lineinfos, intsets, typesrenderer, astalgo, lineinfos, intsets,
pathutils, trees, tables, nimpaths, renderverbatim pathutils, trees, tables, nimpaths, renderverbatim, osproc
from std/private/globs import nativeToUnixPath from std/private/globs import nativeToUnixPath
@ -225,8 +225,9 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
] ]
let cmd = cmd.interpSnippetCmd let cmd = cmd.interpSnippetCmd
rawMessage(conf, hintExecuting, cmd) rawMessage(conf, hintExecuting, cmd)
if execShellCmd(cmd) != status: let (output, gotten) = execCmdEx(cmd)
rawMessage(conf, errGenerated, "executing of external program failed: " & cmd) if gotten != status:
rawMessage(conf, errGenerated, "snippet failed: cmd: '$1' status: $2 expected: $3 output: $4" % [cmd, $gotten, $status, output])
result.emitted = initIntSet() result.emitted = initIntSet()
result.destFile = getOutFile2(conf, presentationPath(conf, filename), outExt, false) result.destFile = getOutFile2(conf, presentationPath(conf, filename), outExt, false)
result.thisDir = result.destFile.splitFile.dir result.thisDir = result.destFile.splitFile.dir