summaryrefslogtreecommitdiff
path: root/ext/pty
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 14:28:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-01 14:28:04 +0000
commite1c33162cf821b5251559564242e0d91ad29a79c (patch)
tree5ab023b4f1168eb6c3a0363082a9ad6760d77665 /ext/pty
parentf14133782b12c3f3998261a736b143b07acd237d (diff)
* ext/pty/pty.c (pty_open): refine the path for master IO.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty')
-rw-r--r--ext/pty/pty.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index cd7aa88f77..9650f533f2 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -453,7 +453,7 @@ pty_close_pty(VALUE assoc)
* The path name of the terminal device can be gotten by slave_file.path.
*
* PTY.open {|m, s|
- * p m #=> #<IO: pty /dev/pts/1>
+ * p m #=> #<IO:masterpty:/dev/pts/1>
* p s #=> #<File:/dev/pts/1>
* p s.path #=> "/dev/pts/1"
* }
@@ -472,6 +472,14 @@ pty_close_pty(VALUE assoc)
* p m.gets #=> "42: 2 3 7\n"
* w.puts "144"
* p m.gets #=> "144: 2 2 2 2 3 3\n"
+ * w.close
+ * # The result of read operation when pty slave is closed is platform dependnet.
+ * ret = begin
+ * m.gets # FreeBSD returns nil.
+ * rescue Errno::EIO # GNU/Linux raises EIO.
+ * nil
+ * end
+ * p ret #=> nil
*
*/
static VALUE
@@ -489,7 +497,7 @@ pty_open(VALUE klass)
MakeOpenFile(master_io, master_fptr);
master_fptr->mode = FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX;
master_fptr->fd = master_fd;
- master_fptr->pathv = rb_obj_freeze(rb_sprintf(" pty %s", slavename));
+ master_fptr->pathv = rb_obj_freeze(rb_sprintf("masterpty:%s", slavename));
slave_file = rb_obj_alloc(rb_cFile);
MakeOpenFile(slave_file, slave_fptr);