module Mina::ExecHelpers::Sys
## Private methods Delegate functions, mostly.
Public Instance Methods
handle_sigint(count, pid, this)
click to toggle source
### Sys.handle_sigint! Called when a `^C` is pressed. The param `count` is how many times it's been pressed since. Returns nothing.
# File lib/mina-extras/jruby-patch.rb, line 49 def handle_sigint(count, pid, this) puts "" if count > 1 this.print_status "Mina: SIGINT received again. Force quitting..." Process.kill "KILL", pid else this.print_status "Mina: SIGINT received." Process.kill "TERM", pid end end
stream_stderr!(err) { |strip| ... }
click to toggle source
### Sys.stream_stderr!
Internal: Read from stderr stream `err` [0], supress expected errors [1], and yield. Returns the PID.
# File lib/mina-extras/jruby-patch.rb, line 64 def stream_stderr!(err, &blk) Thread.new do while str = err.gets #[0] next if str.include? "bash: no job control in this shell" #[1] next if str.include? "stdin is not a terminal" yield str.strip #[2] end end end
stream_stdin!() { |char| ... }
click to toggle source
### Sys.stream_stdin!
Internal: Read from the real stdin stream and pass it onto the given stdin stream `i`. Returns the PID.
# File lib/mina-extras/jruby-patch.rb, line 79 def stream_stdin!(&blk) Thread.new do while (char = STDIN.getbyte rescue nil) yield char if char end end end
stream_stdout(o) { |str| ... }
click to toggle source
### Sys.stream_stdout
Internal: Read from given stdout stream `o` and delegate it to the output helper.
# File lib/mina-extras/jruby-patch.rb, line 91 def stream_stdout(o, &blk) while str = o.getc yield str end end