mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r22464) -Fix [FS#4587]: [Windows] Prevent a crash when launching OpenTTD with -d from a MSYS console. Added a note to known-bugs about this issue.
This commit is contained in:
parent
4c63d8e82f
commit
003dee6e38
@ -293,3 +293,9 @@ Can't change volume inside OpenTTD [FS#4416]
|
|||||||
in OpenTTD. As a result you can't change the volume inside OpenTTD
|
in OpenTTD. As a result you can't change the volume inside OpenTTD
|
||||||
for backends such as SDL; just use the volume control provided by
|
for backends such as SDL; just use the volume control provided by
|
||||||
your operating system.
|
your operating system.
|
||||||
|
|
||||||
|
Can't run OpenTTD with the -d option from a MSYS console [FS#4587]
|
||||||
|
The MSYS console does not allow OpenTTD to open an extra console for
|
||||||
|
debugging output. Compiling OpenTTD with the --enable-console
|
||||||
|
configure option prevents this issue and allows the -d option to use
|
||||||
|
the MSYS console for its output.
|
||||||
|
@ -297,7 +297,21 @@ void CreateConsole()
|
|||||||
|
|
||||||
/* redirect unbuffered STDIN, STDOUT, STDERR to the console */
|
/* redirect unbuffered STDIN, STDOUT, STDERR to the console */
|
||||||
#if !defined(__CYGWIN__)
|
#if !defined(__CYGWIN__)
|
||||||
*stdout = *_fdopen( _open_osfhandle((intptr_t)hand, _O_TEXT), "w" );
|
|
||||||
|
/* Check if we can open a handle to STDOUT. */
|
||||||
|
int fd = _open_osfhandle((intptr_t)hand, _O_TEXT);
|
||||||
|
if (fd == -1) {
|
||||||
|
/* Free everything related to the console. */
|
||||||
|
FreeConsole();
|
||||||
|
_has_console = false;
|
||||||
|
_close(fd);
|
||||||
|
CloseHandle(hand);
|
||||||
|
|
||||||
|
ShowInfo("Unable to open an output handle to the console. Check known-bugs.txt for details.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*stdout = *_fdopen(fd, "w");
|
||||||
*stdin = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT), "r" );
|
*stdin = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT), "r" );
|
||||||
*stderr = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_ERROR_HANDLE), _O_TEXT), "w" );
|
*stderr = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_ERROR_HANDLE), _O_TEXT), "w" );
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user