PasteRack.org
Paste # 95054
2018-10-21 15:16:22

Fork as a new paste.

Paste viewed 2650 times.


Embed:

  1. #! /usr/bin/env racket
  2. #lang racket
  3.  
  4. (match-define (list from-remote
  5.                     to-remote
  6.                     pid
  7.                     error-from-remote
  8.                     control-remote)
  9.   (process "ssh -tt linode"))
  10.  
  11. (define (read-avail from-port)
  12.   (define ready
  13.     (sync
  14.       (read-bytes-evt 1 from-remote)))
  15.  
  16.   (if (not (eof-object? ready))
  17.       (begin
  18.         (display ready)
  19.         (read-avail from-port))
  20.       '()))
  21.  
  22. (thread
  23.   (lambda () (read-avail from-remote)))
  24.  
  25. (displayln
  26.   (port-closed? to-remote))
  27.  
  28. (read)
  29. (displayln "whoami" to-remote)
  30. (read)

=>

subprocess: `execute' access denied for /bin/sh

from-remote: undefined;

 cannot reference an identifier before its definition

  in module: 'm

#<thread>

to-remote: undefined;

 cannot reference an identifier before its definition

  in module: 'm

#<eof>

to-remote: undefined;

 cannot reference an identifier before its definition

  in module: 'm

#<eof>