PipeStream.st
author Claus Gittinger <cg@exept.de>
Tue, 15 Aug 2000 16:34:33 +0200
changeset 5523 86ad12f4afc9
parent 5481 680d6de80808
child 5624 fd80180ce3e2
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 99
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5388
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
    13
"{ Package: 'stx:libbasic' }"
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
    14
269
93162487a94b *** empty log message ***
claus
parents: 255
diff changeset
    15
NonPositionableExternalStream subclass:#PipeStream
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
    16
	instanceVariableNames:'commandString pid exitStatus exitSema exitAction'
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    17
	classVariableNames:'BrokenPipeSignal'
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    18
	poolDictionaries:''
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    19
	category:'Streams-External'
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    20
!
2
claus
parents: 1
diff changeset
    21
217
a0400fdbc933 *** empty log message ***
claus
parents: 180
diff changeset
    22
!PipeStream primitiveDefinitions!
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    23
%{
437
claus
parents: 410
diff changeset
    24
4616
64dd3a9bebf5 *** empty log message ***
ps
parents: 4526
diff changeset
    25
#if defined(WIN32)
793
3d441d66beeb NT changes
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
    26
# undef UNIX_LIKE
3d441d66beeb NT changes
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
    27
# define MSDOS_LIKE
3d441d66beeb NT changes
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
    28
#endif
3d441d66beeb NT changes
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
    29
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
#include <stdio.h>
437
claus
parents: 410
diff changeset
    31
#define _STDIO_H_INCLUDED_
claus
parents: 410
diff changeset
    32
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
#include <errno.h>
437
claus
parents: 410
diff changeset
    34
#define _ERRNO_H_INCLUDED_
claus
parents: 410
diff changeset
    35
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
#ifndef transputer
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
# include <sys/types.h>
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
# include <sys/stat.h>
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
#endif
230
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    40
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    41
/*
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    42
 * on some systems errno is a macro ... check for it here
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    43
 */
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    44
#ifndef errno
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    45
 extern errno;
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    46
#endif
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
    47
1663
dd111ec142da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
    48
#ifdef LINUX
dd111ec142da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
    49
# define BUGGY_STDIO_LIB
dd111ec142da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
    50
#endif
dd111ec142da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
    51
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    52
%}
180
c488255bd0be *** empty log message ***
claus
parents: 159
diff changeset
    53
! !
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    54
325
claus
parents: 308
diff changeset
    55
!PipeStream primitiveFunctions!
claus
parents: 308
diff changeset
    56
%{
claus
parents: 308
diff changeset
    57
claus
parents: 308
diff changeset
    58
/*
2925
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    59
 * no longer needed - popen is useless ...
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    60
 */
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    61
#undef NEED_POPEN_WITH_VFORK
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    62
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    63
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
    64
/*
325
claus
parents: 308
diff changeset
    65
 * some systems (i.e. ultrix) use fork;
claus
parents: 308
diff changeset
    66
 * were better off with a popen based on vfork ...
claus
parents: 308
diff changeset
    67
 */
claus
parents: 308
diff changeset
    68
#ifdef NEED_POPEN_WITH_VFORK
claus
parents: 308
diff changeset
    69
claus
parents: 308
diff changeset
    70
static int popen_pid = 0;
claus
parents: 308
diff changeset
    71
claus
parents: 308
diff changeset
    72
FILE *
claus
parents: 308
diff changeset
    73
popen(command, type)
claus
parents: 308
diff changeset
    74
/* const */ char *command;
claus
parents: 308
diff changeset
    75
/* const */ char *type;
claus
parents: 308
diff changeset
    76
{
claus
parents: 308
diff changeset
    77
    int pipes[2];
claus
parents: 308
diff changeset
    78
    int itype = (strcmp(type, "w") == 0 ? 1 : 0);
claus
parents: 308
diff changeset
    79
claus
parents: 308
diff changeset
    80
    if (pipe(pipes) == -1)
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    81
	return NULL;
325
claus
parents: 308
diff changeset
    82
claus
parents: 308
diff changeset
    83
    switch (popen_pid = vfork()) {
claus
parents: 308
diff changeset
    84
    case -1:
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    85
	(void)close(pipes[0]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    86
	(void)close(pipes[1]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    87
	return NULL;
325
claus
parents: 308
diff changeset
    88
claus
parents: 308
diff changeset
    89
    case 0:
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    90
	if (itype) {
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    91
	    dup2(pipes[0], fileno(stdin));
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    92
	    close(pipes[1]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    93
	} else {
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    94
	    dup2(pipes[1], fileno(stdout));
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    95
	    close(pipes[0]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    96
	}
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    97
	execl("/bin/sh", "/bin/sh", "-c", command, 0);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    98
	fprintf(stderr, "XRN Error: failed the execlp\n");
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
    99
	_exit(-1);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   100
	/* NOTREACHED */
325
claus
parents: 308
diff changeset
   101
claus
parents: 308
diff changeset
   102
    default:
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   103
	    if (itype) {
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   104
		close(pipes[0]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   105
		return fdopen(pipes[1], "w");
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   106
	    } else {
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   107
		close(pipes[1]);
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   108
		return fdopen(pipes[0], "r");
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   109
	    }
325
claus
parents: 308
diff changeset
   110
    }
claus
parents: 308
diff changeset
   111
}
claus
parents: 308
diff changeset
   112
claus
parents: 308
diff changeset
   113
int
claus
parents: 308
diff changeset
   114
pclose(str)
claus
parents: 308
diff changeset
   115
FILE *str;
claus
parents: 308
diff changeset
   116
{
claus
parents: 308
diff changeset
   117
    int pd = 0;
claus
parents: 308
diff changeset
   118
    int status;
claus
parents: 308
diff changeset
   119
    int err;
claus
parents: 308
diff changeset
   120
claus
parents: 308
diff changeset
   121
    err = fclose(str);
claus
parents: 308
diff changeset
   122
claus
parents: 308
diff changeset
   123
    do {
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   124
	if ((pd = wait(&status)) == -1)
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   125
	{
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   126
		err = EOF;
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   127
		break;
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   128
	}
325
claus
parents: 308
diff changeset
   129
    } while (pd !=  popen_pid);
claus
parents: 308
diff changeset
   130
claus
parents: 308
diff changeset
   131
    if (err == EOF)
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   132
	return  -1;
325
claus
parents: 308
diff changeset
   133
claus
parents: 308
diff changeset
   134
    if (status)
326
d2902942491d *** empty log message ***
claus
parents: 325
diff changeset
   135
	status >>= 8;   /* exit status in high byte */
325
claus
parents: 308
diff changeset
   136
claus
parents: 308
diff changeset
   137
    return status;
claus
parents: 308
diff changeset
   138
}
claus
parents: 308
diff changeset
   139
2925
1a64228425ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2896
diff changeset
   140
#endif /* NEED_POPEN_WITH_VFORK */
325
claus
parents: 308
diff changeset
   141
claus
parents: 308
diff changeset
   142
%}
claus
parents: 308
diff changeset
   143
! !
claus
parents: 308
diff changeset
   144
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   145
!PipeStream class methodsFor:'documentation'!
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   146
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   147
copyright
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   148
"
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   149
 COPYRIGHT (c) 1989 by Claus Gittinger
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   150
	      All Rights Reserved
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   151
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   152
 This software is furnished under a license and may be used
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   153
 only in accordance with the terms of that license and with the
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   154
 inclusion of the above copyright notice.   This software may not
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   155
 be provided or otherwise made available to, or used by, any
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   156
 other person.  No title to or ownership of the software is
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   157
 hereby transferred.
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   158
"
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   159
!
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   160
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   161
documentation
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   162
"
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   163
    Pipestreams allow reading or writing from/to a unix command.
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   164
    For example, to get a stream reading the output of an 'ls -l'
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   165
    command, a PipeStream can be created with:
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   166
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   167
	PipeStream readingFrom:'ls -l'
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   168
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   169
    the characters of the commands output can be read using the
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   170
    standard stream messages as next, nextLine etc.
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   171
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   172
    If a writing pipeStream is written to, after the command has finished,
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   173
    UNIX will generate an error-signal (SIGPIPE), which will raise the BrokenPipeSignal. 
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   174
    Thus, to handle this condition correctly, the following code is suggested:
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   175
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   176
	|p|
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   177
	p := PipeStream writingTo:'echo hello'.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   178
	PipeStream brokenPipeSignal handle:[:ex |
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   179
	    'broken pipe' printNewline.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   180
	    p shutDown.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   181
	    ex return
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   182
	] do:[
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   183
	    p nextPutLine:'oops'.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   184
	   'after write' printNewline.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   185
	    p close.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   186
	   'after close' printNewline
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   187
	]
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   188
1663
dd111ec142da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1662
diff changeset
   189
    Notice, that iff the Stream is buffered, the Signal may occur some time after
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   190
    the write - or even at close time; to avoid a recursive signal in the exception
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   191
    handler, a #shutDown is useful there; if you use close in the handler, this would
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   192
    try to send any buffered output to the pipe, leading to another brokenPipe exception.
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   193
1662
ce26ca3d837c linux stdio does not work with buffered pipes
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
   194
    Buffered pipes do not work with Linux - the stdio library seems to be
ce26ca3d837c linux stdio does not work with buffered pipes
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
   195
    buggy (trying to restart the read ...)
ce26ca3d837c linux stdio does not work with buffered pipes
Claus Gittinger <cg@exept.de>
parents: 1648
diff changeset
   196
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   197
    Currently, no filtering pipeStreams (i.e. both reading AND writing) are provided.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   198
    However, if you look at how things are setup, this can be implemented using the
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   199
    low level primitives #mapePipe and #executeCommand from the OS class protocol.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   200
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   201
    [author:]
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   202
	Claus Gittinger
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   203
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   204
    [see also:]
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   205
	ExternalStream FileStream Socket
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   206
	OperatingSystem
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   207
"
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   208
! !
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   209
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   210
!PipeStream class methodsFor:'initialization'!
2
claus
parents: 1
diff changeset
   211
claus
parents: 1
diff changeset
   212
initialize
claus
parents: 1
diff changeset
   213
    "setup the signal"
claus
parents: 1
diff changeset
   214
57
db9677479d35 *** empty log message ***
claus
parents: 49
diff changeset
   215
    BrokenPipeSignal isNil ifTrue:[
582
21f08116b28d BrokenPipeSignal now a child of WriteErrorSignal
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   216
	BrokenPipeSignal := WriteErrorSignal newSignalMayProceed:true.
159
514c749165c3 *** empty log message ***
claus
parents: 99
diff changeset
   217
	BrokenPipeSignal nameClass:self message:#brokenPipeSignal.
514c749165c3 *** empty log message ***
claus
parents: 99
diff changeset
   218
	BrokenPipeSignal notifierString:'write on a pipe with no one to read'.
57
db9677479d35 *** empty log message ***
claus
parents: 49
diff changeset
   219
    ]
2
claus
parents: 1
diff changeset
   220
! !
claus
parents: 1
diff changeset
   221
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   222
!PipeStream class methodsFor:'instance creation'!
2
claus
parents: 1
diff changeset
   223
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   224
readingFrom:commandString
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   225
    "create and return a new pipeStream which can read from the unix command
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   226
     given by command. 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   227
     The commands error output is send to my own error output."
2
claus
parents: 1
diff changeset
   228
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   229
    ^ self 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   230
	readingFrom:commandString 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   231
	errorDisposition:#stderr 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   232
	inDirectory:nil
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   233
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   234
    "unix:
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   235
	PipeStream readingFrom:'ls -l'.
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   236
    "
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   237
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   238
    "
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   239
	p := PipeStream readingFrom:'ls -l'.
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   240
	Transcript showCR:p nextLine.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   241
	p close
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   242
    "
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   243
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   244
    "
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   245
	|s|
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   246
	s := PipeStream readingFrom:'sh -c sleep\ 600'.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   247
	(Delay forSeconds:2) wait.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   248
	s shutDown
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   249
    "
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   250
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   251
    "vms:
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   252
	PipeStream readingFrom:'dir'.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   253
    "
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   254
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   255
    "
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   256
	|p|
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   257
	p := PipeStream readingFrom:'dir'.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   258
	Transcript showCR:p nextLine.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   259
	p close
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   260
    "
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   261
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   262
    "msdos:
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   263
	PipeStream readingFrom:'dir'.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   264
    "
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   265
    "
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   266
	|p|
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   267
	p := PipeStream readingFrom:'dir'.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   268
	Transcript showCR:p nextLine.
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   269
	p close
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   270
    "
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   271
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   272
    "Modified: 24.4.1996 / 09:09:25 / stefan"
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   273
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   274
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   275
readingFrom:commandString errorDisposition:errorDisposition inDirectory:aDirectory
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   276
    "similar to #readingFrom, but changes the directory while
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   277
     executing the command. Use this if a command is to be
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   278
     executed in another directory, to avoid any OS dependencies
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   279
     in your code.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   280
     errorDisposition may be one of #discard, #inline or #stderr (default).
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   281
     #discard causes stderr to be discarded (/dev/null), 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   282
     #inline causes it to be merged into the PipeStream and
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   283
     #stderr causes it to be written to smalltalks own stderr.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   284
     Nil is treated like #stderr"
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   285
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   286
    ^ self basicNew
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   287
	openPipeFor:commandString 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   288
	withMode:'r' 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   289
	errorDisposition:errorDisposition 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   290
	inDirectory:aDirectory
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   291
!
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   292
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   293
readingFrom:commandString inDirectory:aDirectory
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   294
    "similar to #readingFrom, but changes the directory while
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   295
     executing the command. Use this if a command is to be
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   296
     executed in another directory, to avoid any OS dependencies
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   297
     in your code.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   298
     The commands error output is send to my own error output."
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   299
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
   300
     ^ self 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
   301
	readingFrom:commandString
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
   302
	errorDisposition:#stderr 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
   303
	inDirectory:aDirectory
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   304
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   305
    "Modified: 24.9.1997 / 09:33:48 / stefan"
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   306
!
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   307
2
claus
parents: 1
diff changeset
   308
writingTo:commandString
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   309
    "create and return a new pipeStream which can write to the unix command
a27a279701f8 Initial revision
claus
parents:
diff changeset
   310
     given by command."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   311
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   312
    ^ self 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   313
	writingTo:commandString errorDisposition:#stderr inDirectory:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   315
    "unix:
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   316
	 PipeStream writingTo:'sort'
2966
856dfc8a294a lots of VMS changes
Claus Gittinger <cg@exept.de>
parents: 2961
diff changeset
   317
    "
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   318
!
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   319
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   320
writingTo:commandString errorDisposition:errorDisposition inDirectory:aDirectory
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   321
    "similar to #writingTo, but changes the directory while
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   322
     executing the command. Use this if a command is to be
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   323
     executed in another directory, to avoid any OS dependencies
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   324
     in your code.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   325
     errorDisposition may be one of #discard, #inline or #stderr (default).
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   326
     #discard causes stderr to be discarded (/dev/null), 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   327
     #inline causes it to be written to smalltalks own stdout and
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   328
     #stderr causes it to be written to smalltalks own stderr.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   329
     Nil is treated like #stderr"
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   330
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   331
    ^ self basicNew
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   332
	openPipeFor:commandString 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   333
	withMode:'w' 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   334
	errorDisposition:errorDisposition 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   335
	inDirectory:aDirectory
4526
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   336
!
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   337
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   338
writingTo:commandString inDirectory:aDirectory
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   339
    "create and return a new pipeStream which can write to the unix command
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   340
     given by command. The command is executed in the given directory."
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   341
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   342
    ^ self 
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   343
	writingTo:commandString errorDisposition:#stderr inDirectory:aDirectory
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   344
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   345
    "unix:
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   346
	 PipeStream writingTo:'sort'
a42dc8e09586 errorOpen renamed to errorAlreadyOpen
Claus Gittinger <cg@exept.de>
parents: 4202
diff changeset
   347
    "
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   348
! !
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   349
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   350
!PipeStream class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   351
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   352
brokenPipeSignal
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   353
    "return the signal used to handle SIGPIPE unix-signals.
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   354
     Since SIGPIPE is asynchronous, we can't decide which smalltalk process
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   355
     should handle BrokenPipeSignal. So the system doesn't raise 
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   356
     BrokenPipeSignal for SIGPIPE any longer."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   357
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   358
    ^ BrokenPipeSignal
2985
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   359
eff9e86dd2f9 New method #readingFrom:errorDisposition:inDirectory.
Stefan Vogel <sv@exept.de>
parents: 2976
diff changeset
   360
    "Modified: 24.9.1997 / 09:43:23 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   361
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   362
99
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   363
!PipeStream methodsFor:'accessing'!
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   364
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   365
commandString
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   366
    "return the command string"
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   367
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   368
    ^ commandString
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   369
!
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   370
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   371
exitStatus
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   372
    "return exitStatus"
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   373
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   374
    ^ exitStatus
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   375
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   376
    "Created: 28.12.1995 / 14:54:41 / stefan"
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   377
!
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   378
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   379
pid
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   380
    "return pid"
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   381
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   382
    ^ pid
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   383
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   384
    "Created: 28.12.1995 / 14:54:30 / stefan"
99
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   385
! !
afba01fbe15c added access method for commandString
claus
parents: 93
diff changeset
   386
5243
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   387
!PipeStream methodsFor:'finalization'!
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   388
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   389
disposed
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   390
    "redefined to avoid blocking in close."
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   391
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   392
    self shutDown
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   393
! !
d3b509746522 category change
Claus Gittinger <cg@exept.de>
parents: 5205
diff changeset
   394
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   395
!PipeStream methodsFor:'instance release'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   396
a27a279701f8 Initial revision
claus
parents:
diff changeset
   397
closeFile
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   398
    "low level close
230
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
   399
     This waits for the command to finish. 
0300c6797890 interrupt & blocking close
claus
parents: 217
diff changeset
   400
     Use shutDown for a fast (nonBlocking) close."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   401
3834
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   402
    |tpid|
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   403
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   404
    filePointer notNil ifTrue:[
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   405
        super closeFile.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   406
        OperatingSystem isMSDOSlike ifTrue:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   407
            self terminatePipeCommand.
5388
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
   408
        ].
3834
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   409
5388
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
   410
        filePointer := nil.
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
   411
        pid notNil ifTrue:[
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   412
            "/ wait for the pipe-command to terminate.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   413
            self waitForPipeCommandWithTimeout:nil.
5388
bef4d52749a4 terminate command on close (also under unix)
Claus Gittinger <cg@exept.de>
parents: 5243
diff changeset
   414
        ].
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   415
    ].
3833
3ae90f8da01a terminate process BEFORE closing the pipe under win32
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   416
3834
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   417
    "Modified: / 12.9.1998 / 16:51:04 / cg"
369
claus
parents: 362
diff changeset
   418
!
claus
parents: 362
diff changeset
   419
claus
parents: 362
diff changeset
   420
closeFileDescriptor
claus
parents: 362
diff changeset
   421
    "alternative very low level close 
claus
parents: 362
diff changeset
   422
     This closes the underlying OS-fileDescriptor 
claus
parents: 362
diff changeset
   423
     - and will NOT write any buffered data to the stream.
claus
parents: 362
diff changeset
   424
     You have been warned."
claus
parents: 362
diff changeset
   425
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   426
    |action|
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   427
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   428
%{  
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   429
#if !defined(transputer)
369
claus
parents: 362
diff changeset
   430
    OBJ fp;
claus
parents: 362
diff changeset
   431
    FILE *f;
4616
64dd3a9bebf5 *** empty log message ***
ps
parents: 4526
diff changeset
   432
    extern close();
369
claus
parents: 362
diff changeset
   433
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   434
    if ((fp = __INST(filePointer)) != nil) {
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 793
diff changeset
   435
	__INST(filePointer) = nil;
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   436
	f = __FILEVal(fp);
5203
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4616
diff changeset
   437
	if (@global(ExternalStream:FileOpenTrace) == true) {
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4616
diff changeset
   438
	    fprintf(stderr, "close [PipeStream] %x fd=%d\n", f, fileno(f));
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4616
diff changeset
   439
	}
3744
e2c57149f3b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
   440
#ifdef WIN32
4616
64dd3a9bebf5 *** empty log message ***
ps
parents: 4526
diff changeset
   441
	__STX_C_CALL1((void*)close, (void*)fileno(f));
3744
e2c57149f3b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
   442
#else
369
claus
parents: 362
diff changeset
   443
	__BEGIN_INTERRUPTABLE__
claus
parents: 362
diff changeset
   444
	close(fileno(f));
claus
parents: 362
diff changeset
   445
	__END_INTERRUPTABLE__
3744
e2c57149f3b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
   446
#endif
369
claus
parents: 362
diff changeset
   447
    }
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   448
#endif /* not transputer  */
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   449
%}.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   450
    exitAction notNil ifTrue:[
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   451
	action := exitAction.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   452
	exitAction := nil.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   453
	action value.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   454
    ]
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   455
!
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   456
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   457
shutDown
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   458
    "close the Stream, ignoring any broken-pipe errors.
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   459
     Terminate the command"
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   460
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   461
    BrokenPipeSignal catch:[
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   462
        Lobby unregister:self.
3833
3ae90f8da01a terminate process BEFORE closing the pipe under win32
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   463
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   464
        "/ terminate first under windows.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   465
        OperatingSystem isMSDOSlike ifTrue:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   466
            self terminatePipeCommand.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   467
        ].
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   468
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   469
        self closeFileDescriptor.
3834
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   470
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   471
        "/ terminate last under unix.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   472
        OperatingSystem isMSDOSlike ifFalse:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   473
            self terminatePipeCommand.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   474
        ].
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   475
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   476
    ]
1648
faa891d2c1b0 Use OperatingSystem executeCommand:... instead of popen().
Stefan Vogel <sv@exept.de>
parents: 1295
diff changeset
   477
3833
3ae90f8da01a terminate process BEFORE closing the pipe under win32
Claus Gittinger <cg@exept.de>
parents: 3791
diff changeset
   478
    "Modified: / 23.5.1996 / 09:15:41 / stefan"
3834
93ec07316a98 oops - must nil pid when terminating the process
Claus Gittinger <cg@exept.de>
parents: 3833
diff changeset
   479
    "Modified: / 12.9.1998 / 16:50:18 / cg"
5456
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   480
!
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   481
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   482
terminatePipeCommand
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   483
    |tpid|
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   484
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   485
    (tpid := pid) notNil ifTrue:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   486
        OperatingSystem terminateProcess:tpid.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   487
        OperatingSystem terminateProcessGroup:tpid.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   488
        pid := nil.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   489
    ].
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   490
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   491
!
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   492
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   493
waitForPipeCommandWithTimeout:seconds
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   494
    "wait for the pipe command to terminate itself.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   495
     Return true, if a timeout occurred."
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   496
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   497
    pid notNil ifTrue:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   498
        [
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   499
            pid notNil ifTrue:[
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   500
                exitSema waitWithTimeout:seconds.
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   501
            ]
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   502
        ] valueUninterruptably
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   503
    ].
a96c23f8da35 pipe-command termination fix
ca
parents: 5388
diff changeset
   504
    ^ pid notNil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   505
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   506
a27a279701f8 Initial revision
claus
parents:
diff changeset
   507
!PipeStream methodsFor:'private'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   508
2969
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   509
exitAction:aBlock
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   510
    "define a block to be evaluated when the pipe is closed.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   511
     This is only used with VMS, to remove any temporary COM file.
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   512
     (see readingFrom:inDirectory:)"
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   513
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   514
    exitAction := aBlock
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   515
!
1fcf6dfb6004 VMS pipes in another directory
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   516
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   517
openPipeFor:aCommandString withMode:rwMode errorDisposition:err inDirectory:aDirectory
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   518
    "open a pipe to the OS command in commandString; 
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   519
     rwMode may be 'r' or 'w'.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   520
     errorDisposition controls where the stdErr output should go,
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   521
     and may be one of #discard, #inline or #stderr (default).
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   522
     #discard causes stderr to be discarded (/dev/null), 
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   523
     #inline causes it to be written to smalltalks own stdout and
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   524
     #stderr causes it to be written to smalltalks own stderr.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   525
     Nil is treated like #stderr"
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   526
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   527
    |blocked pipeFdArray execFdArray execFd myFd shellAndArgs
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   528
     shellPath shellArgs closeFdArray mbx mbxName 
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   529
     realCmd execDirectory tmpComFile nullOutput|
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   530
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   531
    filePointer notNil ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   532
        "the pipe was already open ...
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   533
         this should (can) not happen."
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   534
        ^ self errorAlreadyOpen
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   535
    ].
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   536
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   537
    rwMode = 'r' ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   538
        mode := #readonly. didWrite := false.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   539
    ] ifFalse:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   540
        mode := #writeonly. didWrite := true.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   541
    ].
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   542
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   543
    lastErrorNumber := nil.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   544
    exitStatus := nil.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   545
    exitSema := Semaphore new name:'pipe exitSema'.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   546
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   547
    realCmd := aCommandString.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   548
    execDirectory := aDirectory.
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   549
3791
76ea6c85ca1f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
   550
    OperatingSystem isVMSlike ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   551
        "/
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   552
        "/ the generated COM-file includes a 'set default'
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   553
        "/
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   554
        tmpComFile := OperatingSystem createCOMFileForVMSCommand:aCommandString in:aDirectory.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   555
        realCmd := '@' , tmpComFile osName.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   556
        execDirectory := nil.
4616
64dd3a9bebf5 *** empty log message ***
ps
parents: 4526
diff changeset
   557
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   558
        mbx := OperatingSystem createMailBox.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   559
        mbx isNil ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   560
            lastErrorNumber := OperatingSystem currentErrorNumber.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   561
            tmpComFile delete.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   562
            ^ self openError
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   563
        ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   564
        mbxName := OperatingSystem mailBoxNameOf:mbx.
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   565
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   566
        "/ 'mailBox is ' print. mbx print. ' name is ' print. mbxName printCR.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   567
        shellPath := ''.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   568
        shellArgs := realCmd.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   569
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   570
        rwMode = 'r' ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   571
            execFdArray := Array with:0 with:mbx with:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   572
            (err == #inline or:[err == #stdout]) ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   573
                execFdArray at:3 put:mbx
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   574
            ]
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   575
        ] ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   576
            execFdArray := Array with:mbx with:1 with:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   577
            (err == #inline or:[err == #stdout]) ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   578
                execFdArray at:3 put:1
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   579
            ]
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   580
        ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   581
        closeFdArray := nil.
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   582
    ] ifFalse:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   583
        OperatingSystem isUNIXlike ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   584
            aDirectory notNil ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   585
                "/ unix - prepend a 'cd' to the command
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   586
                realCmd := 'cd ' , aDirectory asFilename name, '; ' , aCommandString.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   587
            ] ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   588
                realCmd := aCommandString
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   589
            ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   590
            execDirectory := nil.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   591
        ].
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   592
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   593
        pipeFdArray := OperatingSystem makePipe.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   594
        pipeFdArray isNil ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   595
            lastErrorNumber := OperatingSystem currentErrorNumber.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   596
            ^ self openError
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   597
        ].
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   598
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   599
        shellAndArgs := OperatingSystem commandAndArgsForOSCommand:realCmd.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   600
        shellPath := shellAndArgs at:1.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   601
        shellArgs := shellAndArgs at:2.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   602
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   603
        rwMode = 'r' ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   604
            myFd := pipeFdArray at:1.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   605
            execFd := pipeFdArray at:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   606
            execFdArray := Array with:0 with:execFd with:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   607
            (err == #inline or:[err == #stdout]) ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   608
                execFdArray at:3 put:execFd
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   609
            ]
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   610
        ] ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   611
            myFd := pipeFdArray at:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   612
            execFd := pipeFdArray at:1.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   613
            execFdArray := Array with:execFd with:1 with:2.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   614
            (err == #inline or:[err == #stdout]) ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   615
                execFdArray at:3 put:1
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   616
            ]
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   617
        ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   618
        closeFdArray := Array with:myFd.
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   619
    ].
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   620
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   621
    err == #discard ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   622
        nullOutput := Filename nullDevice writeStream.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   623
        execFdArray at:3 put:nullOutput fileDescriptor
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   624
    ].
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   625
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   626
    "/ must block here, to avoid races due to early finishing
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   627
    "/ subprocesses ...
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   628
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   629
    blocked := OperatingSystem blockInterrupts.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   630
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3533
diff changeset
   631
    pid := Processor 
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   632
               monitor:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   633
                  OperatingSystem 
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   634
                      exec:shellPath
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   635
                      withArguments:shellArgs
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   636
                      fileDescriptors:execFdArray
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   637
                      closeDescriptors:closeFdArray
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   638
                      fork:true
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   639
                      newPgrp:true
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   640
                      inDirectory:execDirectory.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   641
               ]
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   642
               action:[:status |
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   643
                  status stillAlive ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   644
                      exitStatus := status.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   645
                      OperatingSystem closePid:pid.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   646
                      pid := nil.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   647
                      exitSema signal.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   648
                  ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   649
               ].
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   650
3791
76ea6c85ca1f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
   651
    OperatingSystem isVMSlike ifFalse:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   652
        OperatingSystem closeFd:execFd.
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   653
    ].
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   654
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   655
    nullOutput notNil ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   656
        nullOutput close
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   657
    ].
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   658
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   659
    pid notNil ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   660
        OperatingSystem isVMSlike ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   661
            "/
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   662
            "/ reopen the mailbox as a file ...
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   663
            "/
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   664
            mbxName := OperatingSystem mailBoxNameOf:mbx.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   665
            mbxName notNil ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   666
                super open:mbxName withMode:rwMode.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   667
                exitAction := [tmpComFile delete].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   668
            ].
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   669
        ] ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   670
            self setFileDescriptor:myFd mode:rwMode.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   671
        ]
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   672
    ] ifFalse:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   673
        lastErrorNumber := OperatingSystem currentErrorNumber.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   674
        OperatingSystem isVMSlike ifTrue:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   675
            OperatingSystem destroyMailBox:mbx.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   676
            tmpComFile delete.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   677
        ] ifFalse:[
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   678
            OperatingSystem closeFd:myFd.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   679
        ].
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   680
    ].
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   681
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   682
    blocked ifFalse:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   683
        OperatingSystem unblockInterrupts
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   684
    ].
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   685
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   686
    lastErrorNumber notNil ifTrue:[
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   687
        "
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   688
         the pipe open failed for some reason ...
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   689
         ... this may be either due to an invalid command string,
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   690
         or due to the system running out of memory (when forking
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   691
         the unix process)
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   692
        "
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   693
        exitAction value.
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   694
        ^ self openError
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   695
    ].
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   696
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   697
    commandString := realCmd.
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   698
%{
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   699
    /* LINUX stdio is corrupt here ... */
3744
e2c57149f3b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
   700
#if defined(BUGGY_STDIO_LIB) || defined(WIN32)
3296
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   701
    __INST(buffered) = false;
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   702
#else
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   703
    __INST(buffered) = true;
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   704
#endif
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   705
%}.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   706
    position := 1.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   707
    hitEOF := false.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   708
    binary := false.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   709
    Lobby register:self.
bd2da537678b md's WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 3196
diff changeset
   710
4202
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   711
    "Modified: / 23.4.1996 / 17:05:59 / stefan"
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   712
    "Modified: / 28.1.1998 / 14:47:34 / md"
b9f85ebd2e38 generalized errorDisposition (for other OS's);
Claus Gittinger <cg@exept.de>
parents: 4125
diff changeset
   713
    "Created: / 19.5.1999 / 12:28:54 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   714
! !
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   715
2266
a94af740c68a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2121
diff changeset
   716
!PipeStream class methodsFor:'documentation'!
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   717
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   718
version
5481
680d6de80808 comment
Claus Gittinger <cg@exept.de>
parents: 5456
diff changeset
   719
    ^ '$Header: /cvs/stx/stx/libbasic/PipeStream.st,v 1.86 2000-07-25 14:13:57 cg Exp $'
1295
83f594f05c52 documentation
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   720
! !
613
0af19c3594fc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   721
PipeStream initialize!