about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-10-29 21:46:33 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-10-29 21:46:33 +0100
commit502a8c9cfec988534b0f2a0f7904f52023c303d3 (patch)
tree9ea31d8ce486c91e75986679809d25a8b5dc4e48
parent1610bec4dfc70709e614f824e867e4b8baaafb87 (diff)
downloadnotyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.tar.gz
notyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.tar.xz
notyet-502a8c9cfec988534b0f2a0f7904f52023c303d3.zip
error handling for #exec
-rwxr-xr-xnotyet14
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+)/