diff options
Diffstat (limited to '')
-rw-r--r-- | src/luarocks/fs/unix/tools.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/luarocks/fs/unix/tools.lua b/src/luarocks/fs/unix/tools.lua index df2eee3f..1f4f2a4e 100644 --- a/src/luarocks/fs/unix/tools.lua +++ b/src/luarocks/fs/unix/tools.lua | |||
@@ -18,9 +18,13 @@ end | |||
18 | -- Uses the module's internal directory stack. | 18 | -- Uses the module's internal directory stack. |
19 | -- @return string: the absolute pathname of the current directory. | 19 | -- @return string: the absolute pathname of the current directory. |
20 | function current_dir() | 20 | function current_dir() |
21 | local pipe = io.popen(vars.PWD) | 21 | local current = cfg.cache_pwd |
22 | local current = pipe:read("*l") | 22 | if not current then |
23 | pipe:close() | 23 | local pipe = io.popen(fs.Q(vars.PWD)) |
24 | current = pipe:read("*l") | ||
25 | pipe:close() | ||
26 | cfg.cache_pwd = current | ||
27 | end | ||
24 | for _, directory in ipairs(dir_stack) do | 28 | for _, directory in ipairs(dir_stack) do |
25 | current = fs.absolute_name(directory, current) | 29 | current = fs.absolute_name(directory, current) |
26 | end | 30 | end |
@@ -33,7 +37,7 @@ end | |||
33 | -- @return boolean: true if command succeeds (status code 0), false | 37 | -- @return boolean: true if command succeeds (status code 0), false |
34 | -- otherwise. | 38 | -- otherwise. |
35 | function execute_string(cmd) | 39 | function execute_string(cmd) |
36 | local code = os.execute(command_at(fs.current_dir(), cmd)) | 40 | local code, err = os.execute(command_at(fs.current_dir(), cmd)) |
37 | if code == 0 or code == true then | 41 | if code == 0 or code == true then |
38 | return true | 42 | return true |
39 | else | 43 | else |