class: TerminalSession
added: #pty
changed: #createTerminalConnectionAndSetupWith:
--- a/TerminalSession.st Sun Jul 07 13:31:18 2013 +0200
+++ b/TerminalSession.st Sun Jul 07 21:34:53 2013 +0200
@@ -59,6 +59,10 @@
pluggableProcessInputAction := something.
!
+pty
+ ^ pty
+!
+
shellCommand
^ shellCommand
!
@@ -118,7 +122,7 @@
createTerminalConnectionAndSetupWith:setupBlock
"create a terminal conenction (pseudo terminal or pipe)"
- |slaveFD|
+ |slaveFD master|
OperatingSystem isMSWINDOWSlike ifTrue:[
"use two pipes to COMMAND.COM"
@@ -147,18 +151,22 @@
inStream := stxToStdinPipe at:2.
] ifFalse:[
"Use a pseudo-tty"
- pty := NonPositionableExternalStream makePTYPair.
+ pty := OperatingSystem makePTY.
pty isNil ifTrue:[
self warn:'Cannot open pty.'.
^ self.
].
+
"/ pty at:1 is the master;
"/ pty at:2 is the slave
- inStream := outStream := (pty at:1).
+ master := NonPositionableExternalStream forReadWriteToFileDescriptor:(pty at:1).
+ master buffered:false.
+
+ inStream := outStream := master.
setupBlock value.
"/ fork a shell process on the slave-side
- slaveFD := (pty at:2) fileDescriptor.
+ slaveFD := (pty at:2).
execFDArray := Array with:slaveFD with:slaveFD with:slaveFD.
].
!
@@ -486,11 +494,11 @@
!TerminalSession class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.3 2013-07-07 11:31:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.4 2013-07-07 19:34:53 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.3 2013-07-07 11:31:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/TerminalSession.st,v 1.4 2013-07-07 19:34:53 cg Exp $'
! !