polyglot icon indicating copy to clipboard operation
polyglot copied to clipboard

Infinite loop while using run-txexpr/imperative!

Open pmatos opened this issue 5 years ago • 3 comments

I was just trying run-txexpr/imperative! and ran into an issue (confirmed with racket 7.5 and 7.7)

$ racket
> (require polyglot)
> (run-txexpr/imperative! '((script ((type "application/racket") (id "main")) "\n#lang racket/base\n(write `(p ,(format \"Today is ~a\" (date->string (current-date)))))")))
exception raised by error display handler: flush-output: output port is closed; original exception raised: flush-output: output port is closed
exception raised by error display handler: flush-output: output port is closed; original exception raised: flush-output: output port is closed
...

And it goes into infinite loop with that message.

pmatos avatar May 26 '20 11:05 pmatos

Yep, that's a bug. I didn't expect that the error display handler would still try to use pipe ports after failing to instantiate a module.

First: Let's get you unblocked. Add the missing (require racket/date) to your script to get desired output. I should have a solution for this today.

zyrolasting avatar May 26 '20 14:05 zyrolasting

Ah - I see what's going on. This is going to enter an infinite loop if the script fails to load properly... Thanks.

pmatos avatar May 26 '20 15:05 pmatos

Cool! It works as I expected, now lets try to make the racket script slightly more complex.

pmatos avatar May 26 '20 15:05 pmatos