diff options
Diffstat (limited to 'ext/pty')
-rw-r--r-- | ext/pty/expect_sample.rb | 2 | ||||
-rw-r--r-- | ext/pty/extconf.rb | 1 | ||||
-rw-r--r-- | ext/pty/pty.c | 4 | ||||
-rw-r--r-- | ext/pty/script.rb | 2 |
4 files changed, 7 insertions, 2 deletions
diff --git a/ext/pty/expect_sample.rb b/ext/pty/expect_sample.rb index c71adcb220..1311476c5d 100644 --- a/ext/pty/expect_sample.rb +++ b/ext/pty/expect_sample.rb @@ -11,7 +11,7 @@ require 'expect' fnames = [] PTY.spawn("ftp ftp.netlab.co.jp") do - |r_f,w_f| + |r_f,w_f,pid| w_f.sync = true $expect_verbose = true diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb index de9517ec0c..63383f7faf 100644 --- a/ext/pty/extconf.rb +++ b/ext/pty/extconf.rb @@ -2,6 +2,7 @@ require 'mkmf' have_header("sys/stropts.h") have_func("setresuid") +$CFLAGS << "-DHAVE_DEV_PTMX" if /cygwin/ === PLATFORM if have_func("openpty") or have_func("_getpty") or have_func("ioctl") diff --git a/ext/pty/pty.c b/ext/pty/pty.c index 8184b90185..0d3ba7f060 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -365,14 +365,18 @@ getDevice(master,slave) if(unlockpt(i) != -1) { if((pn = ptsname(i)) != NULL) { if((j = open(pn, O_RDWR, 0)) != -1) { +#if defined I_PUSH if(ioctl(j, I_PUSH, "ptem") != -1) { if(ioctl(j, I_PUSH, "ldterm") != -1) { +#endif *master = i; *slave = j; strcpy(SlaveName, pn); return; +#if defined I_PUSH } } +#endif } } } diff --git a/ext/pty/script.rb b/ext/pty/script.rb index 6c4027e6b3..6aaafec061 100644 --- a/ext/pty/script.rb +++ b/ext/pty/script.rb @@ -11,7 +11,7 @@ logfile = File.open(ofile,"a") system "stty -echo raw lnext ^_" PTY.spawn("/bin/csh") do - |r_pty,w_pty| + |r_pty,w_pty,pid| Thread.new do while true |