Alas, get rid of the Win specific hack to ask the user to press Return

before exiting when an error happened.  This didn't work right when
Python is invoked from a daemon.
This commit is contained in:
Guido van Rossum 1999-04-07 18:32:51 +00:00
parent a99c5db3aa
commit b6987b13fe
1 changed files with 0 additions and 47 deletions

View File

@ -101,7 +101,6 @@ Py_IsInitialized()
*/ */
extern void win_pre_init(), win_pre_exit();
void void
Py_Initialize() Py_Initialize()
{ {
@ -113,9 +112,6 @@ Py_Initialize()
if (initialized) if (initialized)
return; return;
initialized = 1; initialized = 1;
#ifdef MS_WINDOWS
win_pre_init();
#endif
if ((p = getenv("PYTHONDEBUG")) && *p != '\0') if ((p = getenv("PYTHONDEBUG")) && *p != '\0')
Py_DebugFlag = 1; Py_DebugFlag = 1;
@ -1102,9 +1098,6 @@ Py_Exit(sts)
#ifdef macintosh #ifdef macintosh
PyMac_Exit(sts); PyMac_Exit(sts);
#else #else
#ifdef MS_WINDOWS
win_pre_exit(sts);
#endif
exit(sts); exit(sts);
#endif #endif
} }
@ -1169,43 +1162,3 @@ Py_FdIsInteractive(fp, filename)
(strcmp(filename, "<stdin>") == 0) || (strcmp(filename, "<stdin>") == 0) ||
(strcmp(filename, "???") == 0); (strcmp(filename, "???") == 0);
} }
#ifdef MS_WINDOWS
#include <windows.h>
#include <conio.h>
static int its_my_console = -1;
static void
win_pre_init()
{
HANDLE console;
CONSOLE_SCREEN_BUFFER_INFO info;
if (its_my_console >= 0)
return;
its_my_console = 0;
console = GetStdHandle(STD_OUTPUT_HANDLE);
if (console == INVALID_HANDLE_VALUE)
return;
if (!GetConsoleScreenBufferInfo(console, &info)) {
return;
}
if (info.dwCursorPosition.Y == 0)
its_my_console = 1;
}
static void
win_pre_exit(sts)
int sts;
{
if (sts == 0)
return;
if (its_my_console <= 0)
return;
fprintf(stderr, "Hit any key to exit...");
fflush(stderr);
_getch();
}
#endif