about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-10-29 21:41:49 +0100
committerLeah Neukirchen <leah@vuxu.org>2017-10-29 21:42:02 +0100
commit31c4e03534c24062101aaebf659e0a634e221a1b (patch)
treec711719ce6b777844c62baaef48d256ade39cc48
parent5c27f2a2bd7ecd7b86e7425ec421e4fa26a28d0b (diff)
downloadnotyet-31c4e03534c24062101aaebf659e0a634e221a1b.tar.gz
notyet-31c4e03534c24062101aaebf659e0a634e221a1b.tar.xz
notyet-31c4e03534c24062101aaebf659e0a634e221a1b.zip
run #exec with cwd of sourcefile
-rwxr-xr-xnotyet10
1 files changed, 6 insertions, 4 deletions
diff --git a/notyet b/notyet
index f1b9249..712ccc2 100755
--- a/notyet
+++ b/notyet
@@ -144,10 +144,12 @@ def parse(io, filename=nil)
 
       if desc =~ /^#exec\s+(.+)/
 # - error handling for #exec
-        IO.popen($1) { |f|
-          sub = parse(f, $1)
-          sub.reindent(i+2)
-          children = sub.children
+        Dir.chdir(File.dirname(fname)) {
+          IO.popen($1) { |f|
+            sub = parse(f, $1)
+            sub.reindent(i+2)
+            children = sub.children
+          }
         }
         next  if children.empty?
       elsif desc =~ /^#include\s+(\S+)/