diff --git a/ChangeLog b/ChangeLog
index 11fcb2a5934bb1fbeaeb6bf8cd306c7c7082152e..e07551219625e2308848a93167ad12eacd0ced62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,9 +2,10 @@ CVS code -
 - General
 	- Type misalignments and mem leaks in renumber_all, do_justify
 	  and do_spell (Rocco & Steven Kneizys).
-	- New "External Command" code, originally by Dwayne Rightler.
-	  New function files.c:open_pipe(), changes to do_insertfile(),
-	  new list extcmd_list, cmd is ^X after ^R by default.
+	- New "External Command" code, originally by Dwayne Rightler,
+	  Chris & Rocco. New function files.c:open_pipe(), changes to
+	  do_insertfile(), new list extcmd_list, cmd is ^X after ^R by
+	  default.
 	- Added separate regex variable (color_regex and colormatches)
 	  so that color syntax and regex search/replace can coexist.
 - files.c:
diff --git a/files.c b/files.c
index 4913a0d803eb21f913465e805ba2cc3b6ca453d4..527117b21874d315df3264b719e69bf2c30cec6b 100644
--- a/files.c
+++ b/files.c
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/types.h>
+#include <sys/wait.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -292,6 +293,7 @@ int read_file(int fd, char *filename, int quiet)
 int open_pipe(char *command)
 {
     int fd[2], pid;
+    int fork_status;
   
   /* Make our pipes. */
 
@@ -311,15 +313,22 @@ int open_pipe(char *command)
 	execl("/bin/sh","/bin/sh","-c",command,0);
 	exit(0);
     }
-    else if (pid == -1) {
+
+    /* Else continue as parent */
+
+    close(fd[1]);
+
+    if (pid == -1) {
+	close(fd[0]);
 	statusbar(_("Could not fork"));
 	return 1;
     }
 
-    /* Else continue as parent */
-    close(fd[1]);
     read_file(fd[0],"stdin",0);
     set_modified();
+
+    wait(&fork_status);
+
     return 0;
 }
 #endif /* NANO_SMALL */