? includes/table.inc
Index: commands/core/core.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drush/commands/core/core.drush.inc,v
retrieving revision 1.38
diff -u -p -r1.38 core.drush.inc
--- commands/core/core.drush.inc	15 Oct 2009 15:27:36 -0000	1.38
+++ commands/core/core.drush.inc	16 Oct 2009 01:00:38 -0000
@@ -243,7 +243,7 @@ function core_drush_help($section) {
     case 'drush:help':
       return dt('Execute a drush command. Run `drush help [command]` to view command-specific help.');
     case 'drush:cron':
-      return dt("Runs all cron hooks in all active modules for specified site.");
+      return dt("Runs cron hooks in active modules for specified site.");
     case 'drush:status':
       return dt("View the Drupal version and DB credentials for the current site.");
     case 'drush:script':
@@ -331,12 +331,46 @@ function _core_site_credentials() {
  * To print something to the terminal window, use drush_print().
  *
  */
-function drush_core_cron() {
-  if (drupal_cron_run()) {
-    drush_log(dt('Cron run successfully.'), 'success');
+function drush_core_cron($module='all') {
+  if ( $module == 'all' ) {
+    if ( drupal_cron_run() ) {
+      drush_log(dt('Cron run successfully.'), 'success');
+    }
+    else {
+      drush_set_error('DRUSH_CRON_FAILED', dt('Cron run failed.'));
+    }
   }
   else {
-    drush_set_error('DRUSH_CRON_FAILED', dt('Cron run failed.'));
+    // we aren't doing a full drupal_cron_run() but we should 
+    // still do some checks from that function
+
+    // check cron isn't currently running
+    $semaphore = variable_get('cron_semaphore', FALSE);
+    if ( $semaphore ) {
+      drush_set_error('DRUSH_CRON_RUNNING', dt('Cron is already running'));
+      return ;
+    }
+
+    // check the module is enabled and implements cron
+    if ( !module_exists($module) ) {
+      drush_set_error('DRUSH_CRON_NOTENABLED', dt('Module !module is not enabled', array('!module'=>$module)));          
+      return ;
+    }
+    if ( !function_exists($module.'_cron') ) {
+      drush_set_error('DRUSH_CRON_NOTIMPL', dt('Module !module does not implement hook_cron()', array('!module'=>$module)));
+      return ;
+    }
+    
+    // Register shutdown callback
+    register_shutdown_function('drupal_cron_cleanup');
+    // Lock cron semaphore
+    variable_set('cron_semaphore', time());
+    module_invoke($module,'cron');
+    // we *don't* record cron time because other modules may 
+    // be prevented from running by that
+    watchdog('cron', 'Cron run completed for !module.', array('!module'=>$module), WATCHDOG_NOTICE);
+    // Release cron semaphore
+    variable_del('cron_semaphore');
   }
 }
 
