mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
ksh -i: only print newline on EOF if really interactive
Some regression tests have to be run with the -i option, making the shell behave (mostly) as if it is interactive. This causes ksh to print a final newline upon EOF (Ctrl+D). This is functional if the shell is really interactive, i.e. if standard input is on a terminal and we're not running a shell script: it ensures that a parent shell's prompt appears on a new line. But for tests like ksh -i -c 'testcommands' or ksh -i <<EOF testcommands EOF it's a minor annoyance. Adding an explicit 'exit' is an effective workaround, but we might as well fix it. src/cmd/ksh93/sh/main.c: exfile(): done: - If shell is "interactive", only print final newline if standard input is on a terminal and we're not running a -c script.
This commit is contained in:
parent
bd88cc7f4f
commit
b2bdbef561
1 changed files with 2 additions and 1 deletions
|
@ -593,7 +593,8 @@ done:
|
||||||
sh_popcontext(shp,&buff);
|
sh_popcontext(shp,&buff);
|
||||||
if(sh_isstate(SH_INTERACTIVE))
|
if(sh_isstate(SH_INTERACTIVE))
|
||||||
{
|
{
|
||||||
sfputc(sfstderr,'\n');
|
if(isatty(0) && !sh_isoption(SH_CFLAG))
|
||||||
|
sfputc(sfstderr,'\n');
|
||||||
job_close(shp);
|
job_close(shp);
|
||||||
}
|
}
|
||||||
if(jmpval == SH_JMPSCRIPT)
|
if(jmpval == SH_JMPSCRIPT)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue