equal
deleted
inserted
replaced
183 |
183 |
184 openPTYFor:aCommandString withMode:mode inDirectory:aDirectrory |
184 openPTYFor:aCommandString withMode:mode inDirectory:aDirectrory |
185 "open a pty to the unix command in commandString" |
185 "open a pty to the unix command in commandString" |
186 |
186 |
187 |blocked ptyFdArray execFdArray slaveFd masterFd shellAndArgs |
187 |blocked ptyFdArray execFdArray slaveFd masterFd shellAndArgs |
188 shellPath shellArgs closeFdArray mbx mbxName |
188 shellPath shellArgs mbx mbxName |
189 env shell args| |
189 env shell args| |
190 |
190 |
191 filePointer notNil ifTrue:[ |
191 filePointer notNil ifTrue:[ |
192 "the pipe was already open ... |
192 "the pipe was already open ... |
193 this should (can) not happen." |
193 this should (can) not happen." |
209 |
209 |
210 shellPath := ''. |
210 shellPath := ''. |
211 shellArgs := aCommandString. |
211 shellArgs := aCommandString. |
212 |
212 |
213 execFdArray := Array with:mbx with:mbx with:mbx. |
213 execFdArray := Array with:mbx with:mbx with:mbx. |
214 closeFdArray := nil. |
|
215 ] ifFalse:[ |
214 ] ifFalse:[ |
216 ptyFdArray := OperatingSystem makePTYPair. |
215 ptyFdArray := OperatingSystem makePTYPair. |
217 ptyFdArray isNil ifTrue:[ |
216 ptyFdArray isNil ifTrue:[ |
218 lastErrorNumber := OperatingSystem currentErrorNumber. |
217 lastErrorNumber := OperatingSystem currentErrorNumber. |
219 ^ self openError |
218 ^ self openError |
224 shellArgs := shellAndArgs at:2. |
223 shellArgs := shellAndArgs at:2. |
225 |
224 |
226 masterFd := ptyFdArray at:1. |
225 masterFd := ptyFdArray at:1. |
227 slaveFd := ptyFdArray at:2. |
226 slaveFd := ptyFdArray at:2. |
228 execFdArray := Array with:slaveFd with:slaveFd with:slaveFd. |
227 execFdArray := Array with:slaveFd with:slaveFd with:slaveFd. |
229 closeFdArray := Array with:masterFd. |
|
230 ]. |
228 ]. |
231 |
229 |
232 env := Dictionary new. |
230 env := Dictionary new. |
233 env at:'TERM' put:'dumb'. |
231 env at:'TERM' put:'dumb'. |
234 env at:'SHELL' put:shellPath. |
232 env at:'SHELL' put:shellPath. |
243 OperatingSystem |
241 OperatingSystem |
244 exec:shellPath |
242 exec:shellPath |
245 withArguments:shellArgs |
243 withArguments:shellArgs |
246 environment:env |
244 environment:env |
247 fileDescriptors:execFdArray |
245 fileDescriptors:execFdArray |
248 closeDescriptors:closeFdArray |
|
249 fork:true |
246 fork:true |
250 newPgrp:true |
247 newPgrp:true |
251 "/ inDirectory:aDirectrory. |
248 "/ inDirectory:aDirectrory. |
252 ] |
249 ] |
253 action:[:status | |
250 action:[:status | |
340 ! ! |
337 ! ! |
341 |
338 |
342 !UnixPTYStream class methodsFor:'documentation'! |
339 !UnixPTYStream class methodsFor:'documentation'! |
343 |
340 |
344 version |
341 version |
345 ^ '$Header: /cvs/stx/stx/libbasic2/UnixPTYStream.st,v 1.5 1998-08-27 14:29:38 cg Exp $' |
342 ^ '$Header: /cvs/stx/stx/libbasic2/UnixPTYStream.st,v 1.6 2003-02-27 14:50:38 stefan Exp $' |
346 ! ! |
343 ! ! |