aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept/run.lua')
-rw-r--r--modules/textadept/run.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index b8076ccf..c45d9019 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -25,10 +25,12 @@ function execute(command)
['%(filename)'] = filename,
['%(filename_noext)'] = filename_noext,
})
- local chdir = string.format('cd "%s";\n', filedir)
- local p = io.popen(chdir..command..' 2>&1')
+ local current_dir = lfs.currentdir()
+ lfs.chdir(filedir)
+ local p = io.popen(command..' 2>&1')
local out = p:read('*all')
p:close()
+ lfs.chdir(current_dir)
textadept.print('> '..command..'\n'..out)
buffer:goto_pos(buffer.length)
end