[racket] Racket error reporting and the console window

From: Kieron Hardy (kieron.hardy at gmail.com)
Date: Mon Nov 26 05:50:31 EST 2012


You could run the executable (created with DrRacket from the first code
snippet) directly from a Windows Shell command line, and the error will be
shown in-line in the command window as expected.

But, as you state, clicking on the new executable's icon in an Explorer
window does show a command window briefly, but the command window
disappears before it can be read.

The solution here is to create and use a new Windows Shortcut with a
"target" (specified on the "shortcut" tab in the Shortcut's "Properties"
window) that runs the executable using the Windows command interpreter
(CMD.exe) with the /K option. i.e. Use a Windows Shortcut that explicitly
starts a shell that runs the executable, and keeps the shell open after the
executable ends, e.g.: The new Shortcut's "target" would be set to
something like:

C:\WINDOWS\System32\CMD.exe /K "C:\tmp\file-1.exe"

Note that with /K, the new (sub-)shell must be terminated explicitly, e.g.
by invoking the EXIT command, or by closing the window that displays the



On Fri, Nov 16, 2012 at 2:51 PM, Harry Spier <vasishtha.spier at gmail.com>wrote:

> 1)
> Is there some way to keep the console window open when a racket executable
> reports an error?  (I'm a Windows user)
> For this example, the racket console window closes before I can read the
> contract violation message:
> #lang racket
> (provide/contract [amount positive?])
> (define amount 0)
> This also doesn't stay open for me to read the error message as the
> contract violation is only displayed after I enter a character to continue.
> #lang racket
> (provide/contract [amount positive?])
> (define amount 0)
> (system "PAUSE")
> 2)
> The reason I was doing this little test was that I thought from the
> Racket Guide documentation sections 7.1 and 7.1.1 which used this example,
> that provide/contract only did a contract check when the module was
> required, and I was checking this both in DrRacket and as an executable.
> Thanks,
> Harry Spier
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121126/805b198c/attachment.html>

Posted on the users mailing list.