diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2022-10-12 17:52:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 18:52:22 +0200 |
commit | fa60378a7f992235efd766d656556a3e1e337008 (patch) | |
tree | 64513142377db724faa15ca44b207f6e8ef7a44d | |
parent | 19ff7469161419ff748831d32a09e8d57bae8ab9 (diff) | |
download | Nim-fa60378a7f992235efd766d656556a3e1e337008.tar.gz |
Return error message in output of gorge/staticExec. (#18942)
* Return error message in output of gorge/staticExec. * Document nimLegacyGorgeErrors in changelog.
-rw-r--r-- | changelog.md | 3 | ||||
-rw-r--r-- | compiler/gorgeimpl.nim | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/changelog.md b/changelog.md index 2e8460b7c..ddb299be9 100644 --- a/changelog.md +++ b/changelog.md @@ -89,6 +89,9 @@ - ORC is now the default memory management strategy. Use `--mm:refc` for a transition period. +- The `gorge`/`staticExec` calls will now return a descriptive message in the output + if the execution fails for whatever reason. To get back legacy behaviour use `-d:nimLegacyGorgeErrors`. + ## Standard library additions and changes [//]: # "Changes:" diff --git a/compiler/gorgeimpl.nim b/compiler/gorgeimpl.nim index f58ac5de9..8fac06971 100644 --- a/compiler/gorgeimpl.nim +++ b/compiler/gorgeimpl.nim @@ -49,7 +49,11 @@ proc opGorge*(cmd, input, cache: string, info: TLineInfo; conf: ConfigRef): (str if result[1] == 0: writeFile(filename, result[0]) except IOError, OSError: - if not readSuccessful: result = ("", -1) + if not readSuccessful: + when defined(nimLegacyGorgeErrors): + result = ("", -1) + else: + result = ("Error running startProcess: " & getCurrentExceptionMsg(), -1) else: try: var p = startProcess(cmd, workingDir, @@ -60,4 +64,7 @@ proc opGorge*(cmd, input, cache: string, info: TLineInfo; conf: ConfigRef): (str result = p.readOutput p.close() except IOError, OSError: - result = ("", -1) + when defined(nimLegacyGorgeErrors): + result = ("", -1) + else: + result = ("Error running startProcess: " & getCurrentExceptionMsg(), -1) |