diff options
author | 2008-02-10 21:31:53 -0500 | |
---|---|---|
committer | 2008-02-10 21:31:53 -0500 | |
commit | 2a8b91209627608fe61c21ec96de31b7fffcea94 (patch) | |
tree | 039767373d0a3f688c86cc8c1692fc422b80696d /core/ext | |
parent | 655d3222b8e242bcdb96e9458dc311aee1a658e5 (diff) | |
download | textadept-2a8b91209627608fe61c21ec96de31b7fffcea94.tar.gz textadept-2a8b91209627608fe61c21ec96de31b7fffcea94.zip |
Instead of io.popen():read(), a file descriptor is kept and close()'d afterward.
Diffstat (limited to 'core/ext')
-rw-r--r-- | core/ext/pm/file_browser.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua index 9acf9bec..f48c1346 100644 --- a/core/ext/pm/file_browser.lua +++ b/core/ext/pm/file_browser.lua @@ -12,7 +12,9 @@ end function get_contents_for(full_path) local dirpath = table.concat(full_path, '/') - local out = io.popen('ls -1p "'..dirpath..'"'):read('*all') + local p = io.popen('ls -1p "'..dirpath..'"') + local out = p:read('*all') + p:close() if #out == 0 then error('No such directory: '..dirpath) return {} @@ -49,7 +51,9 @@ function perform_menu_action(menu_item, selected_item) textadept.pm.entry_text = filepath textadept.pm.activate() elseif menu_item == 'File Details' then - local out = io.popen('ls -dhl "'..filepath..'"'):read('*all') + local p = io.popen('ls -dhl "'..filepath..'"') + local out = p:read('*all') + p:close() local perms, num_dirs, owner, group, size, mod_date = out:match('^(%S+) (%S+) (%S+) (%S+) (%S+) (%S+ %S)') out = 'File details for:\n'..filepath..'\n'.. |