Skip to content

Commit

Permalink
Emit shell prompt even when in non-interactive mode.
Browse files Browse the repository at this point in the history
Change-Id: If85c509efe13e4bdb40216c79d560ea7f83ba813
  • Loading branch information
jackpal committed Jun 4, 2010
1 parent 1bc4eae commit ad5431d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sh/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ pgetc(void)
return pgetc_macro();
}

int in_interactive_mode() {
return parsefile != NULL && parsefile->fd == 0;
}

static int
preadfd(void)
Expand Down
1 change: 1 addition & 0 deletions sh/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ extern int parsenleft; /* number of characters left in input buffer */
extern char *parsenextc; /* next character in input buffer */
extern int init_editline; /* 0 == not setup, 1 == OK, -1 == failed */

int in_interactive_mode();
char *pfgets(char *, int);
int pgetc(void);
int preadbuffer(void);
Expand Down
4 changes: 2 additions & 2 deletions sh/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,9 +1629,9 @@ setprompt(int which)
if (!el)
#endif
#ifdef WITH_LINENOISE
#else
out2str(getprompt(NULL));
if (! in_interactive_mode() )
#endif
out2str(getprompt(NULL));
}

/*
Expand Down

0 comments on commit ad5431d

Please sign in to comment.