diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-10-29 21:46:33 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-10-29 21:46:33 +0100 |
commit | 502a8c9cfec988534b0f2a0f7904f52023c303d3 (patch) | |
tree | 9ea31d8ce486c91e75986679809d25a8b5dc4e48 | |
parent | 1610bec4dfc70709e614f824e867e4b8baaafb87 (diff) | |
download | notyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.tar.gz notyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.tar.xz notyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.zip |
error handling for #exec
-rwxr-xr-x | notyet | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/notyet b/notyet index 2745656..bb6b769 100755 --- a/notyet +++ b/notyet @@ -145,11 +145,15 @@ def parse(io, filename=nil) if desc =~ /^#exec\s+(.+)/ # - error handling for #exec Dir.chdir(File.dirname(fname)) { - IO.popen($1) { |f| - sub = parse(f, $1) - sub.reindent(i+2) - children = sub.children - } + begin + IO.popen($1) { |f| + sub = parse(f, $1) + sub.reindent(i+2) + children = sub.children + } + rescue SystemCallError => e + children = [Entry.new(i+2, "?", "ERROR: #{e}", fname, lineno, [])] + end } next if children.empty? elsif desc =~ /^#include\s+(\S+)/ |