diff -U3 wget-1.11.4/src/init.c wget-1.11.4-watchpid/src/init.c
--- wget-1.11.4/src/init.c	2008-04-27 05:48:23 +0000
+++ wget-1.11.4-watchpid/src/init.c	2010-12-27 16:25:55 +0000
@@ -246,6 +246,7 @@
   { "verbose",          NULL,                   cmd_spec_verbose },
   { "wait",             &opt.wait,              cmd_time },
   { "waitretry",        &opt.waitretry,         cmd_time },
+  { "watchpid",         &opt.watchpid,          cmd_number },
 #ifdef MSDOS
   { "wdebug",           &opt.wdebug,            cmd_boolean },
 #endif
diff -U3 wget-1.11.4/src/main.c wget-1.11.4-watchpid/src/main.c
--- wget-1.11.4/src/main.c	2008-06-30 02:22:53 +0000
+++ wget-1.11.4-watchpid/src/main.c	2010-12-27 16:41:42 +0000
@@ -247,6 +247,7 @@
     { "version", 'V', OPT_FUNCALL, (void *) print_version, no_argument },
     { "wait", 'w', OPT_VALUE, "wait", -1 },
     { "waitretry", 0, OPT_VALUE, "waitretry", -1 },
+    { "watchpid", 0, OPT_VALUE, "watchpid", -1 },
 #ifdef MSDOS
     { "wdebug", 0, OPT_BOOLEAN, "wdebug", -1 },
 #endif
@@ -446,6 +447,8 @@
     N_("\
        --waitretry=SECONDS       wait 1..SECONDS between retries of a retrieval.\n"),
     N_("\
+       --watchpid=PID            if the process PID dies, wget also terminates itself.\n"),
+    N_("\
        --random-wait             wait from 0...2*WAIT secs between retrievals.\n"),
     N_("\
        --no-proxy                explicitly turn off proxy.\n"),
diff -U3 wget-1.11.4/src/options.h wget-1.11.4-watchpid/src/options.h
--- wget-1.11.4/src/options.h	2008-04-27 05:48:23 +0000
+++ wget-1.11.4-watchpid/src/options.h	2010-12-27 16:27:22 +0000
@@ -114,6 +114,7 @@
   bool random_wait;		/* vary from 0 .. wait secs by random()? */
   double wait;			/* The wait period between retrievals. */
   double waitretry;		/* The wait period between retries. - HEH */
+  int watchpid;			/* What PID to monitor for terminating. */
   bool use_robots;		/* Do we heed robots.txt? */
 
   wgint limit_rate;		/* Limit the download rate to this
diff -U3 wget-1.11.4/src/retr.c wget-1.11.4-watchpid/src/retr.c
--- wget-1.11.4/src/retr.c	2008-04-27 05:48:23 +0000
+++ wget-1.11.4-watchpid/src/retr.c	2010-12-27 18:32:52 +0000
@@ -307,6 +307,33 @@
       if (opt.limit_rate)
         limit_bandwidth (ret, timer);
 
+      if (opt.watchpid) 
+        {
+#ifdef WINDOWS
+          DWORD exit_code = 0;
+          HANDLE process = OpenProcess (PROCESS_QUERY_INFORMATION, FALSE, opt.watchpid);
+          if (process) 
+            {
+              /* Unfortunately in Windows OpenProcess returns process handle (zomby?)
+                 even if the process is dead, but if this process holds STDOUT/STDERR
+                 of wget. So we must always check exitcode, not non-null result only. 
+                 Exitcode STILL_ACTIVE (259) is reserved in WINAPI for alive processes.
+              */
+              GetExitCodeProcess (process, &exit_code);    	
+              CloseHandle (process);
+            }
+          if (exit_code != 259)  /* 259 = STILL_ACTIVE, see http://msdn.microsoft.com/en-us/library/ms683189.aspx */
+#else
+          if (kill (opt.watchpid, 0) != 0)
+#endif
+            {
+              logprintf (LOG_NOTQUIET, _("\nWatched process %d is dead, aborting wget.\n"), opt.watchpid);
+              ret = -2;
+              errno = 0;
+              goto out;
+            }
+          }
+
       if (progress)
         progress_update (progress, ret, ptimer_read (timer));
 #ifdef WINDOWS
