comparison Python/sysmodule.c @ 36910:91a9e2e31e93 legacy-trunk

Try to be a bit more consistent on all platforms: python . python < . both print a message, return non-zero and do not core dump.
author Neal Norwitz <nnorwitz@gmail.com>
date Thu, 09 Mar 2006 05:58:11 +0000
parents 9eb24f92a784
children 7ada16a14968 57b1ff138995
comparison
equal deleted inserted replaced
36909:0bf53639014a 36910:91a9e2e31e93
1035 { 1035 {
1036 /* XXX: does this work on Win/Win64? (see posix_fstat) */ 1036 /* XXX: does this work on Win/Win64? (see posix_fstat) */
1037 struct stat sb; 1037 struct stat sb;
1038 if (fstat(fileno(stdin), &sb) == 0 && 1038 if (fstat(fileno(stdin), &sb) == 0 &&
1039 S_ISDIR(sb.st_mode)) { 1039 S_ISDIR(sb.st_mode)) {
1040 Py_FatalError("<stdin> is a directory"); 1040 /* There's nothing more we can do. */
1041 /* Py_FatalError() will core dump, so just exit. */
1042 PySys_WriteStderr("Python error: <stdin> is a directory, cannot continue\n");
1043 exit(EXIT_FAILURE);
1041 } 1044 }
1042 } 1045 }
1043 1046
1044 /* Closing the standard FILE* if sys.std* goes aways causes problems 1047 /* Closing the standard FILE* if sys.std* goes aways causes problems
1045 * for embedded Python usages. Closing them when somebody explicitly 1048 * for embedded Python usages. Closing them when somebody explicitly