You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: miniterm.rb
    path of file: ./repos/rust-raspberrypi-OS-tutorials/common/serial
    
    the code of the file until where you have to start completion: #!/usr/bin/env ruby
# frozen_string_literal:
    
    def terminal
        @host_console.raw!

        Thread.abort_on_exception = true
        Thread.report_on_exception = false

        # Receive from target and print on host console.
        target_to_host = Thread.new do
            loop do
                char = @target_serial.getc

                raise ConnectionError if char.nil?

                # Translate incoming newline to newline + carriage return.
                @host_console.putc("\r") if char == "\n"
                @host_console.putc(char)
            end
        end

        # Transmit host console input to target.
        loop do
            c = @host_console.getc

            # CTRL + C in raw mode was pressed.
            if c == "\u{3}"
                target_to_host.kill
                break
            end

            @target_serial.putc(c)
        end