Executing (system ...) command requires another 'ENTER' from repl?

27 views
Skip to first unread message

Yasuaki Kudo

unread,
Dec 13, 2020, 5:19:56 PM12/13/20
to Racket Users
Hi,

I wonder why I need to press ENTER twice in the racket REPL for this command:

racket
Welcome to Racket v7.9 [bc].
> (with-output-to-string (lambda () (system "ls")))
"a.rkt\nfuncs.rkt\nliteral.rkt\nparser.rkt\nparser-test.rkt\nt.rkt\ntuvalu.rkt\n"

>

It executes normally if I run this in a Racket  script as below:

#lang racket
(with-output-to-string (lambda () (system "ls")))


br...@lojic.com

unread,
Dec 29, 2020, 9:44:03 AM12/29/20
to Racket Users
The documentation for (system) states:

"The resulting process writes to (current-output-port), reads from (current-input-port), and logs errors to (current-error-port)."

So, I'm guessing that it may be waiting for input. The following does not require an extra enter key:

(parameterize ([current-input-port (open-input-string "")])
  (with-output-to-string (lambda () (system "ls"))))

Also, DrRacket doesn't require an extra enter key, so maybe there is something going on unique to the command line REPL.

Reply all
Reply to author
Forward
0 new messages