Work in progress

This commit is contained in:
Patrick Lühne 2020-05-27 21:04:19 +02:00
parent 5634359408
commit cac43c064c
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
3 changed files with 25 additions and 5 deletions

View File

@ -1,2 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
stty raw -echo -icanon isig
/usr/bin/github-fast-env --interactive /usr/lib/ghe-fast-tools/ghe-fast-console.rb /usr/bin/github-fast-env --interactive /usr/lib/ghe-fast-tools/ghe-fast-console.rb
stty sane

View File

@ -134,7 +134,9 @@ end
def set_up_pseudoterminal(control_socket, pseudoterminal_path) def set_up_pseudoterminal(control_socket, pseudoterminal_path)
$pseudoterminal_io = File.open(pseudoterminal_path, File::RDWR | File::NOCTTY) $pseudoterminal_io = File.open(pseudoterminal_path, File::RDWR | File::NOCTTY)
$pseudoterminal_io.raw! $pseudoterminal_io.sync = true
#$pseudoterminal_io.raw!
$pseudoterminal_io.cooked!
$original_stderr.puts " connecting to pseudoterminal #{pseudoterminal_path}" $original_stderr.puts " connecting to pseudoterminal #{pseudoterminal_path}"
@ -149,7 +151,7 @@ end
$original_stderr.puts "preloading common modules" $original_stderr.puts "preloading common modules"
#load "/usr/lib/github-fast-env/preload.rb" load "/usr/lib/github-fast-env/preload.rb"
$original_stderr.puts "ready to serve requests" $original_stderr.puts "ready to serve requests"
@ -261,7 +263,9 @@ while true
$original_stderr.puts " finished handling request (#{process_id})" $original_stderr.puts " finished handling request (#{process_id})"
$pseudoterminal_io.close if $pseudoterminal_io
$pseudoterminal_io.close
end
end end
} }

View File

@ -112,6 +112,16 @@ Signal.trap("CONT") do
Process.kill("CONT", 0) Process.kill("CONT", 0)
end end
Signal.trap("WINCH") do
if $pseudoterminal_master
$pseudoterminal_master.winsize = $stdout.winsize
end
if $remote_process_id
Process.kill("WINCH", $remote_process_id)
end
end
def read_command def read_command
ready_ios = IO.select([$control_socket], [], [], 10) ready_ios = IO.select([$control_socket], [], [], 10)
@ -171,11 +181,15 @@ if $options[:interactive]
require "pty" require "pty"
$pseudoterminal_master, pseudoterminal_client = PTY.open $pseudoterminal_master, pseudoterminal_client = PTY.open
$pseudoterminal_master.raw! #$pseudoterminal_master.raw!
$pseudoterminal_master.echo = false
$pseudoterminal_master.sync = true
$pseudoterminal_master.winsize = $stdout.winsize
log "info", "opened pseudoterminal at #{pseudoterminal_client.path}" log "info", "opened pseudoterminal at #{pseudoterminal_client.path}"
encoded_pseudoterminal_client_path = Base64.encode64(pseudoterminal_client.path).delete("\n") encoded_pseudoterminal_client_path = Base64.encode64(pseudoterminal_client.path).delete("\n")
pseudoterminal_client.close
read_ios += [$stdin, $pseudoterminal_master] read_ios += [$stdin, $pseudoterminal_master]
@ -275,7 +289,7 @@ while read_ios.include?($control_socket) or read_ios.include?($pseudoterminal_ma
log "warn", "received input from unknown stream" log "warn", "received input from unknown stream"
end end
rescue EOFError rescue EOFError
if ready_read_io == $control_socket if ready_read_io == $control_socket and $pseudoterminal_master
$pseudoterminal_master.close_write $pseudoterminal_master.close_write
pseudoterminal_master_closed = true pseudoterminal_master_closed = true
end end