diff options
Diffstat (limited to 'core/file_io.lua')
-rw-r--r-- | core/file_io.lua | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 35ca5c03..a313cc66 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -418,48 +418,3 @@ function io.snapopen(paths, filter, exclude_FILTER, opts) for i = 1, #files do files[i] = files[i]:iconv(_CHARSET, 'UTF-8') end io.open_file(files) end - --- On Windows, override `io.popen` and `os.execute` to use winapi to prevent the --- flashing black box. -if WIN32 then - local winapi = require('winapi') - io.popen = function(prog) - local p, f = winapi.spawn_process(os.getenv('COMSPEC')..' /c '..prog) - if not p then return nil, f end - local file - file = { - read = function(self, format) - if not format or not format:find('^%*a') then return f:read() end - local chunk, text = f:read(), {} - while chunk do - text[#text + 1] = chunk - chunk = f:read() - end - return table.concat(text, '') - end, - write = function(self, ...) f:write(...) end, - flush = function() end, - lines = function() - local output, pos = file:read('*a'), 1 - if not output:find('\r?\n$') then output = output..'\n' end - return function() - local s, e, line = output:find('([^\r\n]*)\r?\n', pos) - if not s then return nil end - pos = e + 1 - return line - end - end, - close = function() - local _, status = p:wait(100) - if status == 'TIMEOUT' then p:kill() end - return true, 'exit', p:get_exit_code() - end - } - return file - end - os.execute = function(prog) - if not prog then return true end -- shell is available - local code = winapi.execute(prog) - return code == 0 and true or nil, 'exit', code - end -end |