From 7cdf4702699b5de0e31e1139122aa0486fad24a9 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Fri, 5 Jun 2020 19:04:39 -0700 Subject: [PATCH] refs #14545 fix snippet errors: avoid showing confusing errors when they are expected (#14569) --- compiler/docgen.nim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 0263b36ebc..0af830a42d 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -17,7 +17,7 @@ import packages/docutils/rst, packages/docutils/rstgen, json, xmltree, cgi, trees, types, typesrenderer, astalgo, lineinfos, intsets, - pathutils, trees, tables, nimpaths, renderverbatim + pathutils, trees, tables, nimpaths, renderverbatim, osproc from std/private/globs import nativeToUnixPath @@ -225,8 +225,9 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef, ] let cmd = cmd.interpSnippetCmd rawMessage(conf, hintExecuting, cmd) - if execShellCmd(cmd) != status: - rawMessage(conf, errGenerated, "executing of external program failed: " & cmd) + let (output, gotten) = execCmdEx(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.destFile = getOutFile2(conf, presentationPath(conf, filename), outExt, false) result.thisDir = result.destFile.splitFile.dir