[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs shell.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs shell.c |
Date: |
Mon, 23 Dec 2013 23:33:34 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 13/12/23 23:33:34
Modified files:
. : shell.c
Log message:
shell.c: fixed shell buffer for Haiku
* moved setsid() call before open of pseudo terminal in child process
* increased buffer size to catch all output from child process
* catch stderr output from non interactive processes
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/shell.c?cvsroot=qemacs&r1=1.67&r2=1.68
Patches:
Index: shell.c
===================================================================
RCS file: /sources/qemacs/qemacs/shell.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- shell.c 18 Dec 2013 23:39:53 -0000 1.67
+++ shell.c 23 Dec 2013 23:33:34 -0000 1.68
@@ -190,24 +190,29 @@
}
if (pid == 0) {
/* child process */
+
+ /* detach controlling terminal */
+ setsid();
+
+ /* close all files */
nb_fds = getdtablesize();
for (i = 0; i < nb_fds; i++)
close(i);
- /* open pseudo tty for standard i/o */
+
+ /* open pseudo tty for standard I/O */
if (is_shell == 2) {
- /* non interactive colored output: input from /dev/null */
+ /* collect output from non interactive process: no input */
setenv("LINES", "10000", 1);
open("/dev/null", O_RDONLY);
open(tty_name, O_RDWR);
- dup(0);
+ dup(1);
} else {
+ /* interactive shell: input from / output to pseudo terminal */
open(tty_name, O_RDWR);
dup(0);
dup(0);
}
- setsid();
-
setenv("TERM", "xterm", 1);
unsetenv("PAGER");
//setenv("QELEVEL", "1", 1);
@@ -1250,7 +1255,7 @@
{
ShellState *s = opaque;
QEmacsState *qs = s->qe_state;
- unsigned char buf[1024];
+ unsigned char buf[16 * 1024];
int len, i;
len = read(s->pty_fd, buf, sizeof(buf));