[前][次][番号順一覧][スレッド一覧]

ruby-changes:14920

From: akr <ko1@a...>
Date: Mon, 1 Mar 2010 23:28:40 +0900 (JST)
Subject: [ruby-changes:14920] Ruby:r26790 (trunk): * ext/pty/pty.c (pty_open): refine the path for master IO.

akr	2010-03-01 23:28:04 +0900 (Mon, 01 Mar 2010)

  New Revision: 26790

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26790

  Log:
    * ext/pty/pty.c (pty_open): refine the path for master IO.

  Modified files:
    trunk/ChangeLog
    trunk/ext/pty/pty.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 26789)
+++ ChangeLog	(revision 26790)
@@ -1,3 +1,7 @@
+Mon Mar  1 23:26:56 2010  Tanaka Akira  <akr@f...>
+
+	* ext/pty/pty.c (pty_open): refine the path for master IO.
+
 Mon Mar  1 20:07:06 2010  TAKANO Mitsuhiro (takano32)  <tak@n...>
 
 	* ext/zlib/zlib.c (zstream_expand_buffer_into): remove compare different type values warning.
Index: ext/pty/pty.c
===================================================================
--- ext/pty/pty.c	(revision 26789)
+++ ext/pty/pty.c	(revision 26790)
@@ -453,7 +453,7 @@
  * 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 @@
  *   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 @@
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]