Merge remote-tracking branch 'upstream/master-MC1.8.9' into master-MC1.9.4

This commit is contained in:
payonel 2017-08-08 18:47:44 -07:00
commit a4b470e166
4 changed files with 11 additions and 17 deletions

View File

@ -4,14 +4,10 @@ local tty = require("tty")
local text = require("text") local text = require("text")
local sh = require("sh") local sh = require("sh")
local input = table.pack(...) local args, options = shell.parse(...)
local args = shell.parse(select(3,table.unpack(input)))
if input[2] then
table.insert(args, 1, input[2])
end
shell.prime() shell.prime()
local update_gpu = io.output().tty local update_gpu = io.output().tty and not options.c
local needs_profile = io.input().tty local needs_profile = io.input().tty
local input_handler = {hint = sh.hintHandler} local input_handler = {hint = sh.hintHandler}
@ -38,7 +34,7 @@ if #args == 0 then
io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n") io.stderr:write((reason and tostring(reason) or "unknown error") .. "\n")
end end
end end
elseif not interactive then else
return -- eof return -- eof
end end
if update_gpu and tty.getCursor() > 1 then if update_gpu and tty.getCursor() > 1 then

View File

@ -24,9 +24,6 @@ local source_data = process.list[source_proc].data
source_data.aliases = current_data.aliases -- hacks to propogate sub shell env changes source_data.aliases = current_data.aliases -- hacks to propogate sub shell env changes
source_data.vars = current_data.vars source_data.vars = current_data.vars
source_data.io[0] = file -- set stdin to the file source_data.io[0] = file -- set stdin to the file
if options.q then process.internal.continue(source_proc, "-c")
source_data.io[1] = {tty=false,write=function()end} -- set stdin to the file
end
process.internal.continue(source_proc)
file:close() -- should have closed when the process closed, but just to be sure file:close() -- should have closed when the process closed, but just to be sure

View File

@ -40,5 +40,5 @@ shell.setWorkingDirectory(os.getenv("HOME"))
local home_shrc = shell.resolve(".shrc") local home_shrc = shell.resolve(".shrc")
if fs.exists(home_shrc) then if fs.exists(home_shrc) then
loadfile(shell.resolve("source", "lua"))(home_shrc, "-q") loadfile(shell.resolve("source", "lua"))(home_shrc)
end end

View File

@ -261,12 +261,12 @@ function tty.internal.build_vertical_reader()
} }
end end
-- read n bytes, n is unused -- PLEASE do not use this method directly, use io.read or tty.read
function tty.read(self, handler, cursor) function tty.read(_, handler, cursor)
checkArg(1, handler, "table", "number") checkArg(1, handler, "table", "number")
checkArg(2, cursor, "table", "nil") checkArg(2, cursor, "table", "nil")
if not io.stdin.tty or io.stdin.stream ~= self then if not io.stdin.tty then
return io.stdin:readLine(false) return io.stdin:readLine(false)
end end
@ -320,8 +320,9 @@ function tty.setCursor(x, y)
window.x, window.y = x, y window.x, window.y = x, y
end end
function tty.write(self, value) -- PLEASE do not use this method directly, use io.write or term.write
if not io.stdout.tty or io.stdout.stream ~= self then function tty.write(_, value)
if not io.stdout.tty then
return io.write(value) return io.write(value)
end end
local gpu = tty.gpu() local gpu = tty.gpu()