diff --git a/commands/core/drupal/site_install_6.inc b/commands/core/drupal/site_install_6.inc
index fd12ed3..5d251d7 100644
--- a/commands/core/drupal/site_install_6.inc
+++ b/commands/core/drupal/site_install_6.inc
@@ -24,16 +24,20 @@ function drush_core_site_install_version($profile) {
   // drush_batch functions, but calling the process directly.
   drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_DATABASE);
 
-  $phpcode = _drush_site_install6_cookies($profile, $cli_cookie). ' $_GET["op"]="start"; include("'. $drupal_root .'/install.php");';
-  drush_shell_exec('php -r %s', $phpcode);
+  $status = _drush_site_install6_stage($profile, $cli_cookie, "start");
+  if ($status === FALSE) {
+    return FALSE;
+  }
 
-  while (!_drush_site_install6_batch_check()) {
-    $phpcode = _drush_site_install6_cookies($profile, $cli_cookie). ' $_GET["op"]="do_nojs"; include("'. $drupal_root .'/install.php");';
-    drush_shell_exec('php -r %s', $phpcode);
+  $status = _drush_site_install6_stage($profile, $cli_cookie, "do_nojs");
+  if ($status === FALSE) {
+    return FALSE;
   }
 
-  $phpcode = _drush_site_install6_cookies($profile, $cli_cookie). ' $_GET["op"]="finished"; include("'. $drupal_root .'/install.php");';
-  drush_shell_exec('php -r %s', $phpcode);
+  $status = _drush_site_install6_stage($profile, $cli_cookie, "finished");
+  if ($status === FALSE) {
+    return FALSE;
+  }
 
   $account_pass = drush_get_option('account-pass', drush_generate_password());
   $account_name = drush_get_option('account-name', 'admin');
@@ -61,8 +65,38 @@ function drush_core_site_install_version($profile) {
 }
 
 /**
+ * Submit a given op to install.php; if a meta "Refresh" tag
+ * is returned in the result, then submit that op as well.
+ */
+function _drush_site_install6_stage($profile, $cli_cookie, $initial_op) {
+  $drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
+  // Remember the install task at the start of the stage
+  $install_task = _drush_site_install6_install_task();
+  $op = $initial_op;
+  while (!empty($op)) {
+    $phpcode = _drush_site_install6_cookies($profile, $cli_cookie). ' $_GET["op"]="' . $op . '"; include("'. $drupal_root .'/install.php");';
+    drush_shell_exec('php -r %s', $phpcode);
+    $output = implode("\n", drush_shell_exec_output());
+    // Check for a "Refresh" back to the do_nojs op; e.g.:
+    //   <meta http-equiv="Refresh" content="0; URL=http://default/install.php?locale=en&profile=wk_profile6&id=1&op=do_nojs">
+    // If this pattern is NOT found, then go on to the "finished" step.
+    $matches = array();
+    $match_result = preg_match('/http-equiv="Refresh".*op=([a-zA-Z0-9_]*)/', $output, $matches);
+    if ($match_result) {
+      $op = $matches[1];
+    }
+    else {
+      $op = '';
+    }
+  }
+  if (($install_task == _drush_site_install6_install_task()) && ($initial_op != "finished")) {
+    return drush_set_error('DRUSH_SITE_INSTALL_FAILED', dt("The site install task '!task' failed.", array('!task' => $install_task)));
+  }
+  return TRUE;
+}
+
+/**
  * Utility function to grab/set current "cli cookie".
- *
  */
 function _drush_site_install6_cookies($profile, $cookie = NULL) {
   $drupal_base_url = parse_url(drush_get_option('uri', 'http://default'));
@@ -84,11 +118,12 @@ register_shutdown_function("_cli_cookie_print");';
 }
 
 /**
- * Utility function to see if batch succeeded.
+ * Utility function to check the install_task.  We are
+ * not bootstrapped to a high enough level to use variable_get.
  */
-function _drush_site_install6_batch_check() {
-  if ($data = db_result(db_query("SELECT batch FROM {batch} WHERE bid = %d",1))) {
-    $batch = unserialize($data);
+function _drush_site_install6_install_task() {
+  if ($data = db_result(db_query("SELECT value FROM {variable} WHERE name = 'install_task'",1))) {
+    $result = unserialize($data);
   }
-  return($batch['sets'][0]['success']);
+  return $result;
 }
