Advertisement
Guest User

Untitled

a guest
Feb 13th, 2025
508
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.80 KB | None | 0 0
  1. #lang racket
  2.  
  3.  
  4. (define (main)
  5.   (define args (vector->list (current-command-line-arguments)))
  6.   (define repl-path (car args))
  7.   (define args-for-repl (cdr args))
  8.   (define-values (repl out in err)
  9.     (apply subprocess `(#f #f #f ,repl-path ,@args-for-repl)))
  10.   (printf "subprocess status: ~a" (subprocess-status repl))
  11.   (newline)
  12.   (display "123" in)
  13.   (newline in)
  14.   (flush-output in)
  15.   (printf "subprocess status: ~a" (subprocess-status repl))
  16.   (newline)
  17.   (define result (read-line out))
  18.   (printf "subprocess status: ~a" (subprocess-status repl))
  19.   (newline)
  20.   (if (equal? result "123")
  21.       (printf "Success! (~a)" result)
  22.       (printf "Failure! (~a)" result))
  23.   (newline)
  24.   (close-input-port out)
  25.   (close-input-port err)
  26.   (close-output-port in)
  27.   (subprocess-wait repl))
  28.  
  29. (main)
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement