Dungeon Crawl Stone Soup Tracker - DCSS
Viewing Issue Advanced Details
8773 Bug Report major always 2014-07-09 04:51 2014-08-05 03:40
johnnyzero Local  
neil Windows  
normal Both  
closed 0.15 ancient branch  
bc841a2a done  
none    
none 0.15 ancient branch  
0008773: Cannot view stdout/stderr output on Windows
When something goes wrong during Crawl's initialization, typically the error is handled gracefully with Crawl printing an error message and prompting for input before exit. However, under Windows, no text is output to the console. On my Windows test machine (Vista x64) this error message and prompt is not displayed, although pressing enter will cause crawl to exit. Even after setting the console's current codepage to UTF-8, no output appears.
C:\%CRAWL%>chcp
Active code page: 437

C:\%CRAWL%>chcp 65001
Active code page: 65001



For example, moving the contents of %CRAWL%\data\des causes the following error to be printed to the console after starting Crawl:
C:\%CRAWL%>crawl.exe
Cannot find data file 'des/sprint/meat.des' anywhere, aborting
Hit Enter to continue...


This is a big issue, as Windows users cannot report many startup issues they encounter. Instead, the best report a Windows user can give is, "Well, after I start Crawl the window leaves a blinking cursor until I hit enter".

Commenting out lines 273-274 from source/main.cc (or removing the whole block from 262-275) allows these stdout/stderr messages to appear.

262 #ifdef TARGET_OS_WINDOWS
263     // No documentation about resetting this, nor about which versions of
264     // Windows is required.  Previous ones can't handle writing to the console
265     // outside ancient locales AT ALL via standard means.
266     // Even with _O_U8TEXT, output tends to fail unless the user manually
267     // switches the terminal to a truetype font.  And even that fails for
268     // anything not directly in the font, above U+FFFF, or within Arabic or
269     // any complex scripts.
270 # ifndef _O_U8TEXT
271 #  define _O_U8TEXT 0x40000
272 # endif
273     _setmode(_fileno(stdout), _O_U8TEXT);
274     _setmode(_fileno(stderr), _O_U8TEXT);
275 #endif


This issue affects the current windows trunk builds posted on CDO, as well as my personal builds using the i686-w64-mingw32 toolchain. I have not tested a build compiled with MSVC. Removing these stdout/stderr mode sets does not seem to affect the crawl console gameplay, although I've only tested against Vista x64. Unicode console mode still works fine, for example, as Crawl's console mode implementation in source/libwin32c.cc uses the Windows Console API.

For more reading: http://alfps.wordpress.com/2011/11/22/unicode-part-1-windows-console-io-approaches/ [^]
has duplicate 0007308closed neil Vault errors don't print messages 
Issue History
2014-07-09 04:51 johnnyzero New Issue
2014-07-10 03:33 johnnyzero Note Added: 0026719
2014-08-05 01:42 neil Relationship added has duplicate 0007308
2014-08-05 02:36 neil Note Added: 0026949
2014-08-05 02:36 neil Status new => resolved
2014-08-05 02:36 neil Fixed in Branch => 0.15 prerelease branch
2014-08-05 02:36 neil Resolution open => done
2014-08-05 02:36 neil Assigned To => neil
2014-08-05 03:39 johnnyzero Note Added: 0026950
2014-08-05 03:39 johnnyzero Status resolved => closed

Notes
(0026719)
johnnyzero   
2014-07-10 03:33   
Relevant commits:

(Thanks Grunt!)
(0026949)
neil   
2014-08-05 02:36   
Fixed in trunk (0.16-a0-46-ge5829e7) and prerelease (0.15-b1-33-g66304f2), thanks!
(0026950)
johnnyzero   
2014-08-05 03:39   
Confirmed. Tested a git e5829e7 console build (i686-w64-mingw32 toolchain) under Vista x64. I renamed des/sprint/meat.des to des/sprint/meat.des.bak and tried running crawl after clearing out the saves subdirectory. Crawl successfully printed the expected error message to console. Unicode char_set mode still works fine, as do character + crash log dumps.