UnixPTYStream.st
changeset 668 6cab3f583c93
parent 667 f7f96fedf2ea
child 669 7c81234c0fb9
--- a/UnixPTYStream.st	Thu Jul 09 22:02:12 1998 +0200
+++ b/UnixPTYStream.st	Thu Jul 09 22:19:56 1998 +0200
@@ -69,6 +69,9 @@
     ].
     pty close.
                                                                 [exEnd]
+
+
+  prove (done with a PipeStream):
                                                                 [exBegin]
     |pty|
 
@@ -78,17 +81,10 @@
     ].
     pty close.
                                                                 [exEnd]
-                                                                [exBegin]
-    |pty|
+
 
-    pty := PipeStream readingFrom:'rsh ibm ls -l'.
-    [pty atEnd] whileFalse:[
-        Transcript showCR:(pty nextLine).
-    ].
-    pty close.
-                                                                [exEnd]
-
-  but that one is (simulating an editor session):
+  but that one is not possible with a PipeStream
+  (simulating an editor session):
                                                                 [exBegin]
     |pty|
 
@@ -109,6 +105,28 @@
     pty nextPutLine:'q'.
                                                                 [exEnd]
 
+
+  and that one is even better ...
+  (simulating a login session):
+                                                                [exBegin]
+    |pty password command|
+
+    pty := UnixPTYStream to:'rlogin ' , OperatingSystem getHostName.
+    [
+        pty readWait.
+        [pty atEnd] whileFalse:[
+            Transcript show:(pty next).
+            pty readWait.
+        ].
+        pty close.
+    ] forkAt:9.
+
+    password := Dialog request:'password'.
+    pty nextPutLine:password.
+    command := Dialog request:'command'.
+    pty nextPutLine:command.
+                                                                [exEnd]
+
 "
 ! !
 
@@ -324,5 +342,5 @@
 !UnixPTYStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/UnixPTYStream.st,v 1.1 1998-07-09 20:02:12 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/UnixPTYStream.st,v 1.2 1998-07-09 20:19:56 cg Exp $'
 ! !