equal
deleted
inserted
replaced
132 #endif |
132 #endif |
133 |
133 |
134 %} |
134 %} |
135 ! ! |
135 ! ! |
136 |
136 |
137 !PipeStream class methodsFor:'documentation'! |
137 !PipeStream class methodsFor:'documentation'! |
138 |
138 |
139 copyright |
139 copyright |
140 " |
140 " |
141 COPYRIGHT (c) 1989 by Claus Gittinger |
141 COPYRIGHT (c) 1989 by Claus Gittinger |
142 All Rights Reserved |
142 All Rights Reserved |
189 [author:] |
189 [author:] |
190 Claus Gittinger |
190 Claus Gittinger |
191 " |
191 " |
192 ! ! |
192 ! ! |
193 |
193 |
194 !PipeStream class methodsFor:'initialization'! |
194 !PipeStream class methodsFor:'initialization'! |
195 |
195 |
196 initialize |
196 initialize |
197 "setup the signal" |
197 "setup the signal" |
198 |
198 |
199 BrokenPipeSignal isNil ifTrue:[ |
199 BrokenPipeSignal isNil ifTrue:[ |
201 BrokenPipeSignal nameClass:self message:#brokenPipeSignal. |
201 BrokenPipeSignal nameClass:self message:#brokenPipeSignal. |
202 BrokenPipeSignal notifierString:'write on a pipe with no one to read'. |
202 BrokenPipeSignal notifierString:'write on a pipe with no one to read'. |
203 ] |
203 ] |
204 ! ! |
204 ! ! |
205 |
205 |
206 !PipeStream class methodsFor:'instance creation'! |
206 !PipeStream class methodsFor:'instance creation'! |
207 |
207 |
208 readingFrom:commandString |
208 readingFrom:commandString |
209 "create and return a new pipeStream which can read from the unix command |
209 "create and return a new pipeStream which can read from the unix command |
210 given by command." |
210 given by command." |
211 |
211 |
230 ^ (self basicNew) writingTo:commandString |
230 ^ (self basicNew) writingTo:commandString |
231 |
231 |
232 "PipeStream writingTo:'sort'" |
232 "PipeStream writingTo:'sort'" |
233 ! ! |
233 ! ! |
234 |
234 |
235 !PipeStream class methodsFor:'Signal constants'! |
235 !PipeStream class methodsFor:'Signal constants'! |
236 |
236 |
237 brokenPipeSignal |
237 brokenPipeSignal |
238 "return the signal used to handle SIGPIPE unix-signals" |
238 "return the signal used to handle SIGPIPE unix-signals" |
239 |
239 |
240 ^ BrokenPipeSignal |
240 ^ BrokenPipeSignal |
350 this should (can) not happen." |
350 this should (can) not happen." |
351 ^ self errorOpen |
351 ^ self errorOpen |
352 ]. |
352 ]. |
353 lastErrorNumber := nil. |
353 lastErrorNumber := nil. |
354 exitStatus := nil. |
354 exitStatus := nil. |
355 exitSema := Semaphore new. |
355 exitSema := Semaphore new name:'pipe exitSema'. |
356 |
356 |
357 pipeFdArray := OperatingSystem makePipe. |
357 pipeFdArray := OperatingSystem makePipe. |
358 pipeFdArray isNil ifTrue:[ |
358 pipeFdArray isNil ifTrue:[ |
359 lastErrorNumber := OperatingSystem currentErrorNumber. |
359 lastErrorNumber := OperatingSystem currentErrorNumber. |
360 ^ self openError |
360 ^ self openError |
396 ]. |
396 ]. |
397 |
397 |
398 lastErrorNumber isNil ifTrue:[ |
398 lastErrorNumber isNil ifTrue:[ |
399 commandString := aCommandString. |
399 commandString := aCommandString. |
400 %{ |
400 %{ |
401 /* LINUX stdio is corrupt here ... */ |
401 /* LINUX stdio is corrupt here ... */ |
402 #ifdef BUGGY_STDIO_LIB |
402 #ifdef BUGGY_STDIO_LIB |
403 __INST(buffered) = false; |
403 __INST(buffered) = false; |
404 #else |
404 #else |
405 __INST(buffered) = true; |
405 __INST(buffered) = true; |
406 #endif |
406 #endif |
407 %}. |
407 %}. |
408 hitEOF := false. |
408 hitEOF := false. |
409 binary := false. |
409 binary := false. |
410 Lobby register:self |
410 Lobby register:self |
434 |
434 |
435 mode := #writeonly. didWrite := true. |
435 mode := #writeonly. didWrite := true. |
436 ^ self openPipeFor:command withMode:'w' |
436 ^ self openPipeFor:command withMode:'w' |
437 ! ! |
437 ! ! |
438 |
438 |
439 !PipeStream class methodsFor:'documentation'! |
439 !PipeStream class methodsFor:'documentation'! |
440 |
440 |
441 version |
441 version |
442 ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.49 1997-01-10 13:19:40 cg Exp $' |
442 ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.50 1997-01-24 23:18:40 cg Exp $' |
443 ! ! |
443 ! ! |
444 PipeStream initialize! |
444 PipeStream initialize! |