--- a/TabView.st Fri Apr 23 14:47:39 1999 +0200
+++ b/TabView.st Fri Apr 23 14:49:20 1999 +0200
@@ -887,7 +887,7 @@
"Modified: / 22.4.1998 / 14:20:31 / cg"
! !
-!TabView methodsFor:'initialization'!
+!TabView methodsFor:'initialize / release'!
destroy
listHolder notNil ifTrue:[
@@ -1351,5 +1351,5 @@
!TabView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.38 1999-03-31 05:53:11 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.39 1999-04-23 12:49:10 cg Exp $'
! !
--- a/TerminalView.st Fri Apr 23 14:47:39 1999 +0200
+++ b/TerminalView.st Fri Apr 23 14:49:20 1999 +0200
@@ -617,7 +617,146 @@
"Modified: / 20.6.1998 / 20:30:34 / cg"
! !
-!TerminalView methodsFor:'initialization'!
+!TerminalView methodsFor:'initialization-shell'!
+
+startCommand:aCommand
+ "start a command on a pseudo terminal. If the command arg is nil,
+ a shell is started. The command is started in the current directory.
+ Also fork a reader process, to read the shells output and
+ tell me, whenever something arrives"
+
+ ^ self startCommand:aCommand in:nil
+
+ "Modified: / 20.7.1998 / 18:30:24 / cg"
+!
+
+startCommand:aCommand in:aDirectory
+ "start a command on a pseudo terminal. If the command arg is nil,
+ a shell is started. If aDirectory is not nil, the command is
+ executed in that directory.
+ Also fork a reader process, to read the shells output and
+ tell me, whenever something arrives"
+
+ |p slaveFD execFdArray blocked exitStatus|
+
+ shellCommand := aCommand.
+ shellDirectory := aDirectory.
+
+ self create. "/ need my windowID (to pass down in environment)
+
+ p := ExternalStream makePTYPair.
+ p isNil ifTrue:[
+ self warn:'cannot open pty'.
+ ^ self.
+ ].
+
+ "/ p at:1 is the master;
+ "/ p at:2 is the slave
+ inStream := outStream := (p at:1).
+ inStream buffered:false.
+
+ self defineWindowSize.
+
+ "/ fork a shell process on the slave-side
+ slaveFD := (p at:2) fileDescriptor.
+
+ execFdArray := Array with:slaveFD with:slaveFD with:slaveFD.
+
+ blocked := OperatingSystem blockInterrupts.
+
+ shellPid := Processor
+ monitor:[
+ |e shell cmd args|
+
+ e := Dictionary new.
+ e at:'TERM' put:(self terminalType).
+ e at:'LINES' put:(numberOfLines printString).
+ e at:'COLUMNS' put:(numberOfColumns printString).
+ drawableId notNil ifTrue:[
+ e at:'WINDOWID' put:(drawableId address printString).
+ ].
+
+ aCommand isNil ifTrue:[
+ shell := OperatingSystem getEnvironment:'SHELL'.
+ shell size == 0 ifTrue:[
+ shell := '/bin/sh'.
+ ].
+ cmd := shell asFilename baseName.
+ args := (Array with:cmd).
+ ] ifFalse:[
+ shell := '/bin/sh'.
+ args := (Array with:'sh' with:'-c' with:aCommand).
+ ].
+ e at:'SHELL' put:shell.
+
+ OperatingSystem
+ exec:shell
+ withArguments:args
+ environment:e
+ fileDescriptors:execFdArray
+ closeDescriptors:#()
+ fork:true
+ newPgrp:true
+ inDirectory:aDirectory.
+ ]
+ action:[:status |
+"/ Transcript show:'pid:'; showCR:status pid.
+"/ Transcript show:'status:'; showCR:status status.
+"/ Transcript show:'code:'; showCR:status code.
+"/ Transcript show:'core:'; showCR:status core.
+ status stillAlive ifFalse:[
+ exitStatus := status.
+ OperatingSystem closePid:shellPid.
+ shellPid := nil.
+ self pushEvent:#shellTerminated
+ ].
+ ].
+
+ shellPid isNil ifTrue:[
+ self warn:'Cannot start shell'.
+ (p at:1) close.
+ (p at:2) close.
+ ].
+
+ blocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ].
+
+ self startReaderProcess.
+
+ "Created: / 20.7.1998 / 18:19:32 / cg"
+ "Modified: / 20.7.1998 / 18:30:12 / cg"
+!
+
+startShell
+ "start a shell on a pseudo terminal in the current directory.
+ Also fork a reader process, to read the shells output and
+ tell me, whenever something arrives"
+
+ ^ self startCommand:nil
+
+ "
+ VT100TerminalView openShell
+ "
+
+ "Modified: / 20.7.1998 / 18:29:54 / cg"
+!
+
+startShellIn:aDirectory
+ "start a shell on a pseudo terminal in some directory.
+ Also fork a reader process, to read the shells output and
+ tell me, whenever something arrives"
+
+ ^ self startCommand:nil in:aDirectory
+
+ "
+ VT100TerminalView openShellIn:'/etc'
+ "
+
+ "Modified: / 20.7.1998 / 18:29:46 / cg"
+! !
+
+!TerminalView methodsFor:'initialize / release'!
closeDownShell
|pid|
@@ -867,145 +1006,6 @@
"Modified: / 21.7.1998 / 19:00:13 / cg"
! !
-!TerminalView methodsFor:'initialization-shell'!
-
-startCommand:aCommand
- "start a command on a pseudo terminal. If the command arg is nil,
- a shell is started. The command is started in the current directory.
- Also fork a reader process, to read the shells output and
- tell me, whenever something arrives"
-
- ^ self startCommand:aCommand in:nil
-
- "Modified: / 20.7.1998 / 18:30:24 / cg"
-!
-
-startCommand:aCommand in:aDirectory
- "start a command on a pseudo terminal. If the command arg is nil,
- a shell is started. If aDirectory is not nil, the command is
- executed in that directory.
- Also fork a reader process, to read the shells output and
- tell me, whenever something arrives"
-
- |p slaveFD execFdArray blocked exitStatus|
-
- shellCommand := aCommand.
- shellDirectory := aDirectory.
-
- self create. "/ need my windowID (to pass down in environment)
-
- p := ExternalStream makePTYPair.
- p isNil ifTrue:[
- self warn:'cannot open pty'.
- ^ self.
- ].
-
- "/ p at:1 is the master;
- "/ p at:2 is the slave
- inStream := outStream := (p at:1).
- inStream buffered:false.
-
- self defineWindowSize.
-
- "/ fork a shell process on the slave-side
- slaveFD := (p at:2) fileDescriptor.
-
- execFdArray := Array with:slaveFD with:slaveFD with:slaveFD.
-
- blocked := OperatingSystem blockInterrupts.
-
- shellPid := Processor
- monitor:[
- |e shell cmd args|
-
- e := Dictionary new.
- e at:'TERM' put:(self terminalType).
- e at:'LINES' put:(numberOfLines printString).
- e at:'COLUMNS' put:(numberOfColumns printString).
- drawableId notNil ifTrue:[
- e at:'WINDOWID' put:(drawableId address printString).
- ].
-
- aCommand isNil ifTrue:[
- shell := OperatingSystem getEnvironment:'SHELL'.
- shell size == 0 ifTrue:[
- shell := '/bin/sh'.
- ].
- cmd := shell asFilename baseName.
- args := (Array with:cmd).
- ] ifFalse:[
- shell := '/bin/sh'.
- args := (Array with:'sh' with:'-c' with:aCommand).
- ].
- e at:'SHELL' put:shell.
-
- OperatingSystem
- exec:shell
- withArguments:args
- environment:e
- fileDescriptors:execFdArray
- closeDescriptors:#()
- fork:true
- newPgrp:true
- inDirectory:aDirectory.
- ]
- action:[:status |
-"/ Transcript show:'pid:'; showCR:status pid.
-"/ Transcript show:'status:'; showCR:status status.
-"/ Transcript show:'code:'; showCR:status code.
-"/ Transcript show:'core:'; showCR:status core.
- status stillAlive ifFalse:[
- exitStatus := status.
- OperatingSystem closePid:shellPid.
- shellPid := nil.
- self pushEvent:#shellTerminated
- ].
- ].
-
- shellPid isNil ifTrue:[
- self warn:'Cannot start shell'.
- (p at:1) close.
- (p at:2) close.
- ].
-
- blocked ifFalse:[
- OperatingSystem unblockInterrupts
- ].
-
- self startReaderProcess.
-
- "Created: / 20.7.1998 / 18:19:32 / cg"
- "Modified: / 20.7.1998 / 18:30:12 / cg"
-!
-
-startShell
- "start a shell on a pseudo terminal in the current directory.
- Also fork a reader process, to read the shells output and
- tell me, whenever something arrives"
-
- ^ self startCommand:nil
-
- "
- VT100TerminalView openShell
- "
-
- "Modified: / 20.7.1998 / 18:29:54 / cg"
-!
-
-startShellIn:aDirectory
- "start a shell on a pseudo terminal in some directory.
- Also fork a reader process, to read the shells output and
- tell me, whenever something arrives"
-
- ^ self startCommand:nil in:aDirectory
-
- "
- VT100TerminalView openShellIn:'/etc'
- "
-
- "Modified: / 20.7.1998 / 18:29:46 / cg"
-! !
-
!TerminalView methodsFor:'menu'!
doReset
@@ -1289,5 +1289,5 @@
!TerminalView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.68 1999-04-22 18:48:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.69 1999-04-23 12:49:20 cg Exp $'
! !