.
authorClaus Gittinger <cg@exept.de>
Fri, 27 Oct 1995 13:19:56 +0100
changeset 447 7e27756077fa
parent 446 9005802b114a
child 448 7a62a3d6fadc
.
ExtStream.st
ExternalStream.st
Unix.st
--- a/ExtStream.st	Wed Oct 25 14:40:57 1995 +0100
+++ b/ExtStream.st	Fri Oct 27 13:19:56 1995 +0100
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.57 1995-10-27 12:19:30 cg Exp $
 '!
 
 !ExternalStream primitiveDefinitions!
@@ -73,6 +73,66 @@
 %}
 ! !
 
+!ExternalStream primitiveFunctions!
+%{
+
+static int 
+__fwrite(file, cp, len, buffered)
+    FILE *file;
+    char *cp;
+{
+	int cnt;
+
+#ifdef LINUX
+        errno = 0;
+
+        /*
+         * stdio library has a bug if interrupted
+         * therefore, we go directly into write()
+         */
+        if (! buffered) {
+            int cc, rest;
+
+            cnt = 0;
+            rest = len;
+            do {
+                cc = write(fileno(file), cp, rest);
+                if (cc >= 0) {
+                    cp += cc;
+                    rest -= cc;
+                    cnt += cc;
+                    errno = EINTR; /* kludge */
+                }
+            } while ((cnt != len) && (errno == EINTR));
+        } else {
+            cnt = fwrite(cp, 1, len, file);
+            if (errno == EINTR) errno = 0;
+        }
+#else
+        errno = 0;
+        do {
+            cnt = fwrite(cp, 1, len, file);
+            if (cnt != len) {
+                if (cnt >= 0) {
+                    cp += cnt;
+                    len -= cnt;
+# ifdef HPUX
+                    clearerr(file);
+# endif
+                }
+            }
+        } while ((cnt != len) && (errno == EINTR));
+        if (! buffered) {
+            fflush(file);
+        }
+#endif /* LINUX */
+
+	return cnt;
+}
+
+%}
+! !
+
 !ExternalStream class methodsFor:'documentation'!
 
 copyright
@@ -91,7 +151,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ExtStream.st,v 1.57 1995-10-27 12:19:30 cg Exp $
 "
 !
 
@@ -1363,20 +1423,24 @@
 	    c = __intVal(aByteValue);
 	    f = MKFD(fp);
 	    __BEGIN_INTERRUPTABLE__
-#ifdef OLD
-	    if (_INST(buffered) == false) {
-		cnt = write(fileno(f), &c, 1);
-	    } else 
-#endif
-	    {
-		__WRITING__(f)
-		cnt = fwrite(&c, 1, 1, f);
-#ifndef OLD
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
-#endif
-	    }
+/*
+ *#ifdef OLD
+ *	    if (_INST(buffered) == false) {
+ *		cnt = write(fileno(f), &c, 1);
+ *	    } else 
+ *#endif
+ *	    {
+ *		__WRITING__(f)
+ *		cnt = fwrite(&c, 1, 1, f);
+ *#ifndef OLD
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ *#endif
+ *	    }
+ */
+ 	    __WRITING__(f)
+	    cnt = __fwrite(f, &c, 1, (_INST(buffered) == true));
 	    __END_INTERRUPTABLE__
 
 	    if (cnt == 1) {
@@ -1462,20 +1526,25 @@
 	    if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
 		cp = (char *)__InstPtr(anObject) + nInstBytes + offs;
 		__BEGIN_INTERRUPTABLE__
-#ifdef OLD
-		if (_INST(buffered) == false) {
-		    cnt = write(fileno(f), cp, cnt);
-		} else
-#endif
-		{
-		    __WRITING__(f)
-		    cnt = fwrite(cp, 1, cnt, f);
-		}
-#ifndef OLD
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
-#endif
+/*
+ *#ifdef OLD
+ *		if (_INST(buffered) == false) {
+ *		    cnt = write(fileno(f), cp, cnt);
+ *		} else
+ *#endif
+ *		{
+ *		    __WRITING__(f)
+ *		    cnt = fwrite(cp, 1, cnt, f);
+ *		}
+ *#ifndef OLD
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ *#endif
+ */
+ 	        __WRITING__(f)
+		cnt = __fwrite(f, cp, cnt, (_INST(buffered) == true));
+
 		__END_INTERRUPTABLE__
 
 		if (cnt >= 0) {
@@ -1891,13 +1960,16 @@
 	    f = MKFD(fp);
 
 	    __BEGIN_INTERRUPTABLE__
+#ifdef NONONO
+
 #ifdef OLD
 	    if (_INST(buffered) == false) {
 		cnt = write(fileno(f), cp, len);
-	    } else 
+ 	    } else 
 #endif
 	    { 
 		__WRITING__(f)
+
 #ifdef LINUX
 		errno = 0;
 
@@ -1946,8 +2018,12 @@
 	    if (_INST(buffered) == false) {
 		fflush(f);
 	    }
-
+#endif
+
+	    __WRITING__(f)
+	    cnt = __fwrite(f, cp, len, (_INST(buffered) == true));
 	    __END_INTERRUPTABLE__
+
 	    if (cnt == len) {
 		pos = _INST(position);
 		if (pos != nil) {
@@ -2014,23 +2090,27 @@
 		__BEGIN_INTERRUPTABLE__
 		len = index2 - index1 + 1;
 
-		__WRITING__(f)
-                
-		do {
-		    cnt = fwrite(cp + index1 - 1, 1, len, f);
-		    if (cnt != len) {
-			if (cnt >= 0) {
-			    if (errno == EINTR) {
-				cp += cnt;
-				len -= cnt;
-			    }
-			}
-		    }
-		} while ((cnt != len) && (errno == EINTR));
-
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
+/*
+ *		__WRITING__(f)
+ *               
+ *		do {
+ *		    cnt = fwrite(cp + index1 - 1, 1, len, f);
+ *		    if (cnt != len) {
+ *			if (cnt >= 0) {
+ *			    if (errno == EINTR) {
+ *				cp += cnt;
+ *				len -= cnt;
+ *			    }
+ *			}
+ *		    }
+ *		} while ((cnt != len) && (errno == EINTR));
+ *
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ */
+	        __WRITING__(f)
+	        cnt = __fwrite(f, cp+index1-1, len, (_INST(buffered) == true));
 
 		__END_INTERRUPTABLE__
 		if (cnt == len) {
@@ -2178,6 +2258,7 @@
 		    }
 		} else {
 		    do {
+			errno = 0;
 			len = read(fd, rslt, 1);
 		    } while ((len < 0) && (errno == EINTR));
 		}
@@ -2253,29 +2334,44 @@
 		len = _stringSize(aString);
 
 		__BEGIN_INTERRUPTABLE__
-#ifdef OLD
-		if (_INST(buffered) == false) {
-		    cnt = write(fileno(f), s, len);
-		} else 
-#endif
-		{ 
-		    __WRITING__(f)
-		    cnt = fwrite(s, 1, len, f);
-		}
+/*
+ *#ifdef OLD
+ *		if (_INST(buffered) == false) {
+ *		    cnt = write(fileno(f), s, len);
+ *		} else 
+ *#endif
+ *		{ 
+ *		    __WRITING__(f)
+ *		    cnt = fwrite(s, 1, len, f);
+ *		}
+ *		if (cnt == len) {
+ *#ifdef OLD
+ *		    if (_INST(buffered) == false) {
+ *			cnt = write(fileno(f), "\n", 1);
+ *		    } else 
+ *#endif
+ *		    { 
+ *			cnt = fwrite("\n", 1, 1, f);
+ *		    }
+ *#ifndef OLD
+ *		    if (_INST(buffered) == false) {
+ *			if (fflush(f) == EOF) goto end;
+ *		    }
+ *#endif
+ *		    if (cnt == 1) {
+ *			pos = _INST(position);
+ *			if (pos != nil) {
+ *			    _INST(position) = __MKSMALLINT(__intVal(pos)+len+1);
+ *			}
+ *			__END_INTERRUPTABLE__
+ *			RETURN ( self );
+ *		    }
+ *		}
+ */
+		__WRITING__(f)
+		cnt = __fwrite(f, s, len, (_INST(buffered) == true));
 		if (cnt == len) {
-#ifdef OLD
-		    if (_INST(buffered) == false) {
-			cnt = write(fileno(f), "\n", 1);
-		    } else 
-#endif
-		    { 
-			cnt = fwrite("\n", 1, 1, f);
-		    }
-#ifndef OLD
-		    if (_INST(buffered) == false) {
-			if (fflush(f) == EOF) goto end;
-		    }
-#endif
+		    cnt = __fwrite(f, "\n", 1, (_INST(buffered) == true));
 		    if (cnt == 1) {
 			pos = _INST(position);
 			if (pos != nil) {
@@ -2285,6 +2381,7 @@
 			RETURN ( self );
 		    }
 		}
+		
 end:
 		__END_INTERRUPTABLE__
 		_INST(lastErrorNumber) = __MKSMALLINT(errno);
--- a/ExternalStream.st	Wed Oct 25 14:40:57 1995 +0100
+++ b/ExternalStream.st	Fri Oct 27 13:19:56 1995 +0100
@@ -24,7 +24,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.57 1995-10-27 12:19:30 cg Exp $
 '!
 
 !ExternalStream primitiveDefinitions!
@@ -73,6 +73,66 @@
 %}
 ! !
 
+!ExternalStream primitiveFunctions!
+%{
+
+static int 
+__fwrite(file, cp, len, buffered)
+    FILE *file;
+    char *cp;
+{
+	int cnt;
+
+#ifdef LINUX
+        errno = 0;
+
+        /*
+         * stdio library has a bug if interrupted
+         * therefore, we go directly into write()
+         */
+        if (! buffered) {
+            int cc, rest;
+
+            cnt = 0;
+            rest = len;
+            do {
+                cc = write(fileno(file), cp, rest);
+                if (cc >= 0) {
+                    cp += cc;
+                    rest -= cc;
+                    cnt += cc;
+                    errno = EINTR; /* kludge */
+                }
+            } while ((cnt != len) && (errno == EINTR));
+        } else {
+            cnt = fwrite(cp, 1, len, file);
+            if (errno == EINTR) errno = 0;
+        }
+#else
+        errno = 0;
+        do {
+            cnt = fwrite(cp, 1, len, file);
+            if (cnt != len) {
+                if (cnt >= 0) {
+                    cp += cnt;
+                    len -= cnt;
+# ifdef HPUX
+                    clearerr(file);
+# endif
+                }
+            }
+        } while ((cnt != len) && (errno == EINTR));
+        if (! buffered) {
+            fflush(file);
+        }
+#endif /* LINUX */
+
+	return cnt;
+}
+
+%}
+! !
+
 !ExternalStream class methodsFor:'documentation'!
 
 copyright
@@ -91,7 +151,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.56 1995-10-23 16:53:43 cg Exp $
+$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.57 1995-10-27 12:19:30 cg Exp $
 "
 !
 
@@ -1363,20 +1423,24 @@
 	    c = __intVal(aByteValue);
 	    f = MKFD(fp);
 	    __BEGIN_INTERRUPTABLE__
-#ifdef OLD
-	    if (_INST(buffered) == false) {
-		cnt = write(fileno(f), &c, 1);
-	    } else 
-#endif
-	    {
-		__WRITING__(f)
-		cnt = fwrite(&c, 1, 1, f);
-#ifndef OLD
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
-#endif
-	    }
+/*
+ *#ifdef OLD
+ *	    if (_INST(buffered) == false) {
+ *		cnt = write(fileno(f), &c, 1);
+ *	    } else 
+ *#endif
+ *	    {
+ *		__WRITING__(f)
+ *		cnt = fwrite(&c, 1, 1, f);
+ *#ifndef OLD
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ *#endif
+ *	    }
+ */
+ 	    __WRITING__(f)
+	    cnt = __fwrite(f, &c, 1, (_INST(buffered) == true));
 	    __END_INTERRUPTABLE__
 
 	    if (cnt == 1) {
@@ -1462,20 +1526,25 @@
 	    if ( (offs >= 0) && (cnt >= 0) && (objSize >= (cnt + offs)) ) {
 		cp = (char *)__InstPtr(anObject) + nInstBytes + offs;
 		__BEGIN_INTERRUPTABLE__
-#ifdef OLD
-		if (_INST(buffered) == false) {
-		    cnt = write(fileno(f), cp, cnt);
-		} else
-#endif
-		{
-		    __WRITING__(f)
-		    cnt = fwrite(cp, 1, cnt, f);
-		}
-#ifndef OLD
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
-#endif
+/*
+ *#ifdef OLD
+ *		if (_INST(buffered) == false) {
+ *		    cnt = write(fileno(f), cp, cnt);
+ *		} else
+ *#endif
+ *		{
+ *		    __WRITING__(f)
+ *		    cnt = fwrite(cp, 1, cnt, f);
+ *		}
+ *#ifndef OLD
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ *#endif
+ */
+ 	        __WRITING__(f)
+		cnt = __fwrite(f, cp, cnt, (_INST(buffered) == true));
+
 		__END_INTERRUPTABLE__
 
 		if (cnt >= 0) {
@@ -1891,13 +1960,16 @@
 	    f = MKFD(fp);
 
 	    __BEGIN_INTERRUPTABLE__
+#ifdef NONONO
+
 #ifdef OLD
 	    if (_INST(buffered) == false) {
 		cnt = write(fileno(f), cp, len);
-	    } else 
+ 	    } else 
 #endif
 	    { 
 		__WRITING__(f)
+
 #ifdef LINUX
 		errno = 0;
 
@@ -1946,8 +2018,12 @@
 	    if (_INST(buffered) == false) {
 		fflush(f);
 	    }
-
+#endif
+
+	    __WRITING__(f)
+	    cnt = __fwrite(f, cp, len, (_INST(buffered) == true));
 	    __END_INTERRUPTABLE__
+
 	    if (cnt == len) {
 		pos = _INST(position);
 		if (pos != nil) {
@@ -2014,23 +2090,27 @@
 		__BEGIN_INTERRUPTABLE__
 		len = index2 - index1 + 1;
 
-		__WRITING__(f)
-                
-		do {
-		    cnt = fwrite(cp + index1 - 1, 1, len, f);
-		    if (cnt != len) {
-			if (cnt >= 0) {
-			    if (errno == EINTR) {
-				cp += cnt;
-				len -= cnt;
-			    }
-			}
-		    }
-		} while ((cnt != len) && (errno == EINTR));
-
-		if (_INST(buffered) == false) {
-		    fflush(f);
-		}
+/*
+ *		__WRITING__(f)
+ *               
+ *		do {
+ *		    cnt = fwrite(cp + index1 - 1, 1, len, f);
+ *		    if (cnt != len) {
+ *			if (cnt >= 0) {
+ *			    if (errno == EINTR) {
+ *				cp += cnt;
+ *				len -= cnt;
+ *			    }
+ *			}
+ *		    }
+ *		} while ((cnt != len) && (errno == EINTR));
+ *
+ *		if (_INST(buffered) == false) {
+ *		    fflush(f);
+ *		}
+ */
+	        __WRITING__(f)
+	        cnt = __fwrite(f, cp+index1-1, len, (_INST(buffered) == true));
 
 		__END_INTERRUPTABLE__
 		if (cnt == len) {
@@ -2178,6 +2258,7 @@
 		    }
 		} else {
 		    do {
+			errno = 0;
 			len = read(fd, rslt, 1);
 		    } while ((len < 0) && (errno == EINTR));
 		}
@@ -2253,29 +2334,44 @@
 		len = _stringSize(aString);
 
 		__BEGIN_INTERRUPTABLE__
-#ifdef OLD
-		if (_INST(buffered) == false) {
-		    cnt = write(fileno(f), s, len);
-		} else 
-#endif
-		{ 
-		    __WRITING__(f)
-		    cnt = fwrite(s, 1, len, f);
-		}
+/*
+ *#ifdef OLD
+ *		if (_INST(buffered) == false) {
+ *		    cnt = write(fileno(f), s, len);
+ *		} else 
+ *#endif
+ *		{ 
+ *		    __WRITING__(f)
+ *		    cnt = fwrite(s, 1, len, f);
+ *		}
+ *		if (cnt == len) {
+ *#ifdef OLD
+ *		    if (_INST(buffered) == false) {
+ *			cnt = write(fileno(f), "\n", 1);
+ *		    } else 
+ *#endif
+ *		    { 
+ *			cnt = fwrite("\n", 1, 1, f);
+ *		    }
+ *#ifndef OLD
+ *		    if (_INST(buffered) == false) {
+ *			if (fflush(f) == EOF) goto end;
+ *		    }
+ *#endif
+ *		    if (cnt == 1) {
+ *			pos = _INST(position);
+ *			if (pos != nil) {
+ *			    _INST(position) = __MKSMALLINT(__intVal(pos)+len+1);
+ *			}
+ *			__END_INTERRUPTABLE__
+ *			RETURN ( self );
+ *		    }
+ *		}
+ */
+		__WRITING__(f)
+		cnt = __fwrite(f, s, len, (_INST(buffered) == true));
 		if (cnt == len) {
-#ifdef OLD
-		    if (_INST(buffered) == false) {
-			cnt = write(fileno(f), "\n", 1);
-		    } else 
-#endif
-		    { 
-			cnt = fwrite("\n", 1, 1, f);
-		    }
-#ifndef OLD
-		    if (_INST(buffered) == false) {
-			if (fflush(f) == EOF) goto end;
-		    }
-#endif
+		    cnt = __fwrite(f, "\n", 1, (_INST(buffered) == true));
 		    if (cnt == 1) {
 			pos = _INST(position);
 			if (pos != nil) {
@@ -2285,6 +2381,7 @@
 			RETURN ( self );
 		    }
 		}
+		
 end:
 		__END_INTERRUPTABLE__
 		_INST(lastErrorNumber) = __MKSMALLINT(errno);
--- a/Unix.st	Wed Oct 25 14:40:57 1995 +0100
+++ b/Unix.st	Fri Oct 27 13:19:56 1995 +0100
@@ -22,7 +22,7 @@
 COPYRIGHT (c) 1988 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.60 1995-10-24 16:09:42 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.61 1995-10-27 12:19:56 cg Exp $
 '!
 
 !OperatingSystem primitiveDefinitions!
@@ -601,7 +601,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.60 1995-10-24 16:09:42 cg Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.61 1995-10-27 12:19:56 cg Exp $
 "
 !
 
@@ -1020,14 +1020,15 @@
 
 getHostName
     "return the hostname we are running on - if there is
-     a HOST environment variable, we are much faster here ..."
-
-    |name p|
+     a HOST environment variable, we are much faster here ...
+     Notice:
+	not all systems support this; on some, 'unknown' is returned."
+
+    |name|
 
     HostName notNil ifTrue:[
 	^ HostName
     ].
-    name := self getEnvironment:'HOST'.
 
 %{  /* STACK: 2048 */
 #if defined(HAS_GETHOSTNAME)
@@ -1047,26 +1048,13 @@
 #endif
 %}.
     name isNil ifTrue:[
-	"since fork might be slow on some machines, give a warning ..."
-
-	ForkFailed ifFalse:[
-	    'please set the HOST shell variable for a faster startup' errorPrintNL.
-
-	    PipeStream openErrorSignal handle:[:ex |
-		ForkFailed := true.
-		'UNIX: cannot fork/popen' errorPrintNL.
-		ex return.
-	    ] do:[
-		p := PipeStream readingFrom:'hostname'.
-		p notNil ifTrue:[
-		    name := p nextLine.
-		    p close
-		]
-	    ]
+	name := self getEnvironment:'HOST'.
+	name isNil ifTrue:[
+	    name := self getCommandOutputFrom:'hostname'
 	]
     ].
     name isNil ifTrue:[
-	'cannot find out hostname' errorPrintNL.
+	'OS: cannot find out hostname' errorPrintNL.
 	name := 'unknown'.
     ].
     HostName := name.
@@ -1077,6 +1065,48 @@
     "
 !
 
+getDomainName
+    "return the domain this host is in.
+     Notice:
+	not all systems support this; on some, 'unknown' is returned."
+
+    |name|
+
+%{  /* STACK: 2048 */
+#if defined(HAS_GETDOMAINNAME)
+    char buffer[128];
+
+    if (getdomainname(buffer, sizeof(buffer)) == 0) {
+	name = _MKSTRING(buffer COMMA_CON);
+    }
+#else
+# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
+    struct utsname ubuff;
+
+    if (uname(&ubuff) >= 0) {
+	name = _MKSTRING(ubuff.domainname COMMA_CON);
+    }
+# endif
+#endif
+%}.
+    name isNil ifTrue:[
+	name := self getEnvironment:'DOMAIN'.
+	name isNil ifTrue:[
+	    name := self getCommandOutputFrom:'domainname'
+	]
+    ].
+    name isNil ifTrue:[
+	'OS: cannot find out domainname' errorPrintNL.
+	name := 'unknown'.
+    ].
+    HostName := name.
+    ^ name
+
+    "
+     OperatingSystem getDomainName
+    "
+!
+
 getSystemInfo
     "return info on the system weare running on - if the
      system supports the uname system call, that infor is returned;
@@ -1106,7 +1136,7 @@
 	rel  = _MKSTRING(ubuff.release COMMA_CON);
 	ver  = _MKSTRING(ubuff.version COMMA_CON);
 	mach = _MKSTRING(ubuff.machine COMMA_CON);
-# ifdef LINUX
+# ifdef HAS_UTS_DOMAINNAME
 	dom  = _MKSTRING(ubuff.domainname COMMA_CON);
 # endif
     }
@@ -1122,6 +1152,9 @@
     node isNil ifTrue:[
 	node := self getHostName
     ].
+    domain isNil ifTrue:[
+	dom := self getDomainName
+    ].
 
     info := IdentityDictionary new.
     info at:#system put:sys.
@@ -1141,7 +1174,7 @@
     "if supported by the OS, return the systemID;
      a unique per machine identification.
      WARNING:
-	not all systems support this."
+	not all systems support this; on some, 'unknown' is returned."
 
 %{  /* NO_CONTEXT */
 #if defined(IRIX5) && !defined(HAS_GETHOSTID)
@@ -1308,6 +1341,28 @@
 %}
 .
     ^ true
+!
+
+getCommandOutputFrom:aCommand
+    "execute a simple command (such as hostname) and
+     return the commands output as a string"
+
+    |p result|
+
+    ForkFailed ifFalse:[
+	PipeStream openErrorSignal handle:[:ex |
+	    ForkFailed := true.
+	    'OS: cannot fork/popen' errorPrintNL.
+	    ex return.
+	] do:[
+	    p := PipeStream readingFrom:aCommand.
+	    p notNil ifTrue:[
+		result := p nextLine.
+		p close
+	    ]
+	]
+    ].
+    ^ result
 ! !
 
 !OperatingSystem class methodsFor:'users & groups'!
@@ -4224,7 +4279,7 @@
 	(SlowFork==true or:[ForkFailed]) ifFalse:[
 	    PipeStream openErrorSignal handle:[:ex |
 		ForkFailed := true.
-		'UNIX: cannot fork/popen' errorPrintNL.
+		'OS: cannot fork/popen' errorPrintNL.
 		ex return.
 	    ] do:[
 		"have to fall back ..."
@@ -4233,7 +4288,7 @@
 	    ].
 
 	    (p isNil or:[p atEnd]) ifTrue:[
-		('UNIX: PipeStream for <' , command , '> failed') errorPrintNL.
+		('OS: PipeStream for <' , command , '> failed') errorPrintNL.
 	    ] ifFalse:[
 		path := p nextLine.
 		p close.