diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 17:36:45 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-07-24 17:36:50 -0700 |
| commit | d7e297844c88022cf10ebeb14759a8df7dd539c4 (patch) | |
| tree | f6ff3310c6708ef351cea0efcd1791a2eb41a502 /files.lua | |
| parent | f7a9d1fc6b2ccd95f2f8df49f99073a6d2be9bb8 (diff) | |
Fixed stdin handling.
Diffstat (limited to 'files.lua')
| -rw-r--r-- | files.lua | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -26,6 +26,7 @@ local _FILE_CACHE = setmetatable({ }, { }) local _BROWSE_CACHE = { } Files.spoof = function(filename, contents) + print("SPOOFING " .. tostring(filename)) _SPOOFED_FILES[filename] = contents return contents end @@ -65,6 +66,9 @@ Files.exists = function(path) if _SPOOFED_FILES[path] then return true end + if path == 'stdin' then + return true + end if run_cmd("ls " .. tostring(sanitize(path))) then return true end @@ -116,7 +120,7 @@ if ok then end browse = function(filename) if not (_BROWSE_CACHE[filename]) then - if _SPOOFED_FILES[filename] then + if _SPOOFED_FILES[filename] or filename == 'stdin' then _BROWSE_CACHE[filename] = { filename } @@ -174,11 +178,17 @@ Files.walk = function(path, flush_cache) _BROWSE_CACHE = { } end local files - for nomsupath in package.nomsupath:gmatch("[^;]+") do - do - files = browse(nomsupath .. "/" .. path) - if files then - break + if path == 'stdin' then + files = { + path + } + else + for nomsupath in package.nomsupath:gmatch("[^;]+") do + do + files = browse(nomsupath .. "/" .. path) + if files then + break + end end end end |
