Comment 2 for bug 1256034

I was able to trace this to commit


This is where fd's on Windows were replaced by using HANDLEs instead.
As stated in the documentation for GetStdHandle ( it'll return NULL when the application has no standard handles available.

SB-IMPL:STREAM-REINIT queries these handles and makes fd streams from them (to assign to *stdin* *stdout* *stderr*) and it's where things are going bad. (Specifically, nil was being thrown as the 'fd' in make-fd-stream.)

When running a "GUI Application" on Windows, that application won't be allocated STDIN, STDOUT, or STDERR handles.
If the parent process of that application -did- have these handles allocated, then the child process will inherit them. This is why I was able to launch sbcl from the command-line fine, and not from explorer.exe.

The difference between using fd's and HANDLES in this case is that the CRT (lowio) file descriptors always exist, even if the handles behind them do not.

I'm looking at creating a /dev/null equivalent for cases where the standard handles are not available.