mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-04 18:50:37 +02:00
Only set StdInputHandle, StdOutputHandle and StdErrorHandle once
git-svn-id: trunk@29094 -
This commit is contained in:
parent
64af966eaa
commit
260c6583cf
@ -498,9 +498,15 @@ procedure SysInitStdIO;
|
|||||||
begin
|
begin
|
||||||
{ Setup stdin, stdout and stderr, for GUI apps redirect stderr,stdout to be
|
{ Setup stdin, stdout and stderr, for GUI apps redirect stderr,stdout to be
|
||||||
displayed in a messagebox }
|
displayed in a messagebox }
|
||||||
StdInputHandle:=longint(GetStdHandle(cardinal(STD_INPUT_HANDLE)));
|
{ WARNING: this should be done only once at startup,
|
||||||
StdOutputHandle:=longint(GetStdHandle(cardinal(STD_OUTPUT_HANDLE)));
|
not for DLL entry code, as the standard handles might
|
||||||
StdErrorHandle:=longint(GetStdHandle(cardinal(STD_ERROR_HANDLE)));
|
have been redirected }
|
||||||
|
if StdInputHandle=0 then
|
||||||
|
StdInputHandle:=longint(GetStdHandle(cardinal(STD_INPUT_HANDLE)));
|
||||||
|
if StdOutputHandle=0 then
|
||||||
|
StdOutputHandle:=longint(GetStdHandle(cardinal(STD_OUTPUT_HANDLE)));
|
||||||
|
if StdErrorHandle=0 then
|
||||||
|
StdErrorHandle:=longint(GetStdHandle(cardinal(STD_ERROR_HANDLE)));
|
||||||
if not IsConsole then
|
if not IsConsole then
|
||||||
begin
|
begin
|
||||||
AssignError(stderr);
|
AssignError(stderr);
|
||||||
|
Loading…
Reference in New Issue
Block a user