? .provision.inc.swp
? ads
? partial.verify.merge.diff
Index: provision.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/provision/provision.inc,v
retrieving revision 1.31.2.8
diff -u -r1.31.2.8 provision.inc
--- provision.inc	27 Nov 2008 23:16:36 -0000	1.31.2.8
+++ provision.inc	28 Nov 2008 01:39:27 -0000
@@ -12,6 +12,8 @@
  * @see provisionvalues
  */
 
+define('PROVISION_OUTPUT', 'PROVISION_OUTPUT>>>');
+
 /**
  * Invoke provision api calls. 
  * 
@@ -94,6 +96,35 @@
 
 }
 
+function provision_parse_output($lines) {
+  $start = FALSE;
+  $output = '';
+  foreach ($lines as $line) {
+    if (preg_match('/^' . PROVISION_OUTPUT . '/', $line)) {
+      // found the start out output.
+      $line = str_replace(PROVISION_OUTPUT, '', $line);
+      $start = TRUE;
+    }
+    if ($start) {
+      $output .= $line;
+    }
+    else {
+      if (!trim($line)) {
+        $messages[] = array('type' => 'warning', 'message' => $line, 'timestamp' => time());
+      }
+    }
+  }
+  if ($start) {
+    $data = unserialize($output);
+    if (is_array($data)) {
+      if (is_array($messages)) {
+        $data['log'] = array_merge($data['log'], $messages);
+      }
+      return $data;
+    }
+  }
+  return false;
+}
 
 
 /**
@@ -121,7 +152,7 @@
   $return['log'] = provision_get_log(); // Append logging information
   $return['messages'] = drupal_get_messages();
   if (PROVISION_DRUSH_BACKEND) {
-    print serialize($return);
+    print PROVISION_OUTPUT . serialize($return);
   }
   else {
     if ($return) {
@@ -614,9 +645,8 @@
  */
 function provision_exec($cmd, &$data) {
   exec($cmd, $return, $code);
-  $return = join("", $return);
   provision_log('command', t('Running: @cmd', array('@cmd' => $cmd)));
-  $values = unserialize($return);
+  $values = provision_parse_output($return);
   if (is_array($values)) {
     $data = array_merge($data, $values['site']);
     foreach ($values['log'] as $log) {
@@ -629,7 +659,7 @@
   }
   else {
     provision_set_error(PROVISION_FRAMEWORK_ERROR);
-    provision_log('error',t("The command could not be executed succesfully (returned: !return, code: %code)", array("!return" => $return, "%code" =>  $code)));
+    provision_log('error',t("The command could not be executed succesfully (returned: !return, code: %code)", array("!return" => implode('', $return), "%code" =>  $code)));
     return FALSE;
   }
 };
