diff --git a/C/iopreds.c b/C/iopreds.c index 4a27b43a0..99764ee44 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -347,6 +347,8 @@ unix_upd_stream_info (StreamDesc * s) #if _MSC_VER || defined(__MINGW32__) { struct _stat buf; + char *emacs_env = getenv("EMACS"); + if (_fstat(YP_fileno(s->u.file.file), &buf) == -1) { return; } @@ -354,6 +356,11 @@ unix_upd_stream_info (StreamDesc * s) s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f; /* make all console descriptors unbuffered */ setvbuf(s->u.file.file, NULL, _IONBF, 0); + } else if (emacs_env != NULL && strcmp(emacs_env,"t") == 0) { + /* emacs communicates with sub-processes via a pipe */ + s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f; + /* make all console descriptors unbuffered */ + setvbuf(s->u.file.file, NULL, _IONBF, 0); } return; } @@ -867,7 +874,6 @@ ReadlineGetc(int sno) in_getc = TRUE; /* Do it the gnu way */ if (sigsetjmp(readline_jmpbuf, TRUE)) { - printf("hello\n"); if (PrologMode & InterruptMode) { PrologMode &= ~InterruptMode; ProcessSIGINT();