mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Add $PYTHONSTARTUP feature.
This commit is contained in:
parent
14b4adbd33
commit
da8cd8638f
1 changed files with 10 additions and 0 deletions
|
@ -105,6 +105,16 @@ main(argc, argv)
|
||||||
sts = run_command(command) != 0;
|
sts = run_command(command) != 0;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue