summaryrefslogtreecommitdiff
path: root/PC/launcher.c
diff options
context:
space:
mode:
Diffstat (limited to 'PC/launcher.c')
-rw-r--r--PC/launcher.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/PC/launcher.c b/PC/launcher.c
index 8aef49a628..eac01f8ad8 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -98,7 +98,7 @@ error(int rc, wchar_t * format, ... )
MessageBox(NULL, message, TEXT("Python Launcher is sorry to say ..."),
MB_OK);
#endif
- ExitProcess(rc);
+ exit(rc);
}
/*
@@ -655,7 +655,7 @@ run_child(wchar_t * cmdline)
if (!ok)
error(RC_CREATE_PROCESS, L"Failed to get exit code of process");
debug(L"child process exit code: %d\n", rc);
- ExitProcess(rc);
+ exit(rc);
}
static void
@@ -1114,7 +1114,7 @@ maybe_handle_shebang(wchar_t ** argv, wchar_t * cmdline)
*/
FILE * fp;
errno_t rc = _wfopen_s(&fp, *argv, L"rb");
- unsigned char buffer[BUFSIZE];
+ char buffer[BUFSIZE];
wchar_t shebang_line[BUFSIZE + 1];
size_t read;
char *p;
@@ -1136,7 +1136,8 @@ maybe_handle_shebang(wchar_t ** argv, wchar_t * cmdline)
fclose(fp);
if ((read >= 4) && (buffer[3] == '\n') && (buffer[2] == '\r')) {
- ip = find_by_magic((buffer[1] << 8 | buffer[0]) & 0xFFFF);
+ ip = find_by_magic((((unsigned char)buffer[1]) << 8 |
+ (unsigned char)buffer[0]) & 0xFFFF);
if (ip != NULL) {
debug(L"script file is compiled against Python %ls\n",
ip->version);
@@ -1362,6 +1363,7 @@ process(int argc, wchar_t ** argv)
wchar_t * av[2];
#endif
+ setvbuf(stderr, (char *)NULL, _IONBF, 0);
wp = get_env(L"PYLAUNCH_DEBUG");
if ((wp != NULL) && (*wp != L'\0'))
log_fp = stderr;