aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/sh.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/toys/pending/sh.c b/toys/pending/sh.c
index 784c7a01..d3a9e59c 100644
--- a/toys/pending/sh.c
+++ b/toys/pending/sh.c
@@ -3189,7 +3189,7 @@ FILE *fpathopen(char *name)
void sh_main(void)
{
- char *new, *cc = TT.sh.c;
+ char *new, *cc = 0;
struct sh_function scratch;
int prompt = 0;
struct string_list *sl = 0;
@@ -3216,10 +3216,13 @@ void sh_main(void)
// if (!FLAG(noprofile)) { }
// Is this an interactive shell?
- if (FLAG(s) || (!FLAG(c) && !toys.optc)) TT.options |= OPT_S;
- if (FLAG(i) || (!FLAG(c) && (TT.options&OPT_S) && isatty(0)))
- TT.options |= OPT_I;
- if (FLAG(c)) TT.options |= OPT_C;
+ if (toys.stacktop) {
+ cc = TT.sh.c;
+ if (FLAG(s) || (!FLAG(c) && !toys.optc)) TT.options |= OPT_S;
+ if (FLAG(i) || (!FLAG(c) && (TT.options&OPT_S) && isatty(0)))
+ TT.options |= OPT_I;
+ if (FLAG(c)) TT.options |= OPT_C;
+ }
// Read environment for exports from parent shell. Note, calls run_sh()
// which blanks argument sections of TT and this, so parse everything