Commits

Anonymous committed b3c3640

Backport 42932:

Try to be a bit more consistent on all platforms:
python .
python < .

both print a message, return non-zero and do not core dump.
This hopefully fixes the failure on Solaris.

Comments (0)

Files changed (2)

Lib/test/test_cmd_line.py

         return subprocess.call([sys.executable, cmd_line], stderr=subprocess.PIPE)
 
     def test_directories(self):
-         if sys.platform == 'win32':
-             # Exit code for "python .", Error 13: permission denied = 2
-             expected_exit_code = 2
-         else:
-             # Linux has no problem with "python .", Exit code = 0
-             expected_exit_code = 0
-         self.assertEqual(self.exit_code('.'), expected_exit_code)
-         self.assertTrue(self.exit_code('< .') != 0)
+        self.assertNotEqual(self.exit_code('.'), 0)
+        self.assertNotEqual(self.exit_code('< .'), 0)
 
     def verify_valid_flag(self, cmd_line):
         data = self.start_python(cmd_line)
 				struct stat sb;
 				if (fstat(fileno(fp), &sb) == 0 &&
 				    S_ISDIR(sb.st_mode)) {
-					fprintf(stderr, "%s: warning '%s' is a directory\n", argv[0], filename);
+					fprintf(stderr, "%s: '%s' is a directory, cannot continue\n", argv[0], filename);
+					return 1;
 				}
 			}
 		}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.