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