PasteRack.org
Paste # 7804
2018-10-21 15:16:39

Fork as a new paste.

Paste viewed 2934 times.


Embed:

#! /usr/bin/env racket
#lang racket

(match-define (list from-remote
                    to-remote
                    pid
                    error-from-remote
                    control-remote)
  (process "ssh -tt linode"))

(define (read-avail from-port)
  (define ready
    (sync
      (read-bytes-evt 1 from-remote)))

  (if (not (eof-object? ready))
      (begin
        (display ready)
        (read-avail from-port))
      '()))

(thread
  (lambda () (read-avail from-remote)))

(displayln
  (port-closed? to-remote))

(read)
(displayln "whoami" to-remote)
(read)