mirror of
https://github.com/python/cpython.git
synced 2024-11-29 21:05:33 +08:00
Add $PYTHONSTARTUP feature.
This commit is contained in:
parent
14b4adbd33
commit
da8cd8638f
@ -105,6 +105,16 @@ main(argc, argv)
|
||||
sts = run_command(command) != 0;
|
||||
}
|
||||
else {
|
||||
if (filename == NULL && isatty((int)fileno(fp))) {
|
||||
char *startup = getenv("PYTHONSTARTUP");
|
||||
if (startup != NULL && startup[0] != '\0') {
|
||||
FILE *fp = fopen(startup, "r");
|
||||
if (fp != NULL) {
|
||||
(void) run_script(fp, startup);
|
||||
err_clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user