From 3faef98a2a38b9924b9ae606a80ab17e1d4d3d38 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 7 Aug 2007 05:58:41 +0000 Subject: * ext/pty/pty.c (establishShell): handshaking before close slave device. [ruby-talk:263410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pty/pty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ext') diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 65b892d174..92e7c3b349 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -197,7 +197,7 @@ establishShell(argc, argv, info, SlaveName) char SlaveName[DEVICELEN]; { int i,master,slave; - char *p,*getenv(); + char *p, tmp, *getenv(); struct passwd *pwent; VALUE v; struct exec_info arg; @@ -270,6 +270,7 @@ establishShell(argc, argv, info, SlaveName) } close(master); #endif + write(slave, "", 1); dup2(slave,0); dup2(slave,1); dup2(slave,2); @@ -285,6 +286,7 @@ establishShell(argc, argv, info, SlaveName) _exit(1); } + read(master, &tmp, 1); close(slave); info->child_pid = i; @@ -351,6 +353,7 @@ get_device_once(master, slave, SlaveName, fail) #if defined I_PUSH && !defined linux if(ioctl(j, I_PUSH, "ptem") != -1) { if(ioctl(j, I_PUSH, "ldterm") != -1) { + ioctl(j, I_PUSH, "ttcompat"); #endif *master = i; *slave = j; -- cgit v1.2.3