diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2014-03-20 13:54:07 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2014-03-20 13:54:07 -0300 |
commit | 3aa7e7a08f0dd756e31ce34e4c9ae9bf0169d49a (patch) | |
tree | c93c0668b559787b8ab153cdad5626157f8a7371 /src | |
parent | 0e8c96437c6cf9892ef2f0555ba849fc88e674cb (diff) | |
download | luarocks-3aa7e7a08f0dd756e31ce34e4c9ae9bf0169d49a.tar.gz luarocks-3aa7e7a08f0dd756e31ce34e4c9ae9bf0169d49a.tar.bz2 luarocks-3aa7e7a08f0dd756e31ce34e4c9ae9bf0169d49a.zip |
Bring the Unix implementation up to par with the Windows one!
Diffstat (limited to 'src')
-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 |