mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 21:51:40 +03:00
Merge pull request #8770 from WalterBright/setmode
fix Issue 23312 - Crash when calling writeln in WinMain
This commit is contained in:
commit
b3e664e174
1 changed files with 6 additions and 3 deletions
|
@ -3112,10 +3112,13 @@ is empty, throws an `Exception`. In case of an I/O error throws
|
|||
// "wide-oriented" for us.
|
||||
immutable int mode = __setmode(f.fileno, _O_TEXT);
|
||||
// Set some arbitrary mode to obtain the previous one.
|
||||
__setmode(f.fileno, mode); // Restore previous mode.
|
||||
if (mode & (_O_WTEXT | _O_U16TEXT | _O_U8TEXT))
|
||||
if (mode != -1) // __setmode() succeeded
|
||||
{
|
||||
orientation_ = 1; // wide
|
||||
__setmode(f.fileno, mode); // Restore previous mode.
|
||||
if (mode & (_O_WTEXT | _O_U16TEXT | _O_U8TEXT))
|
||||
{
|
||||
orientation_ = 1; // wide
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue