Development

Changeset 8481

You must first sign up to be able to contribute.

Changeset 8481

Show
Ignore:
Timestamp:
04/16/08 14:00:54 (5 months ago)
Author:
hartym
Message:

#3348 cli.php does not send the system status code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/command/cli.php

    r7612 r8481  
    1818 
    1919  $application = new sfSymfonyCommandApplication($dispatcher, new sfAnsiColorFormatter(), array('symfony_lib_dir' => realpath(dirname(__FILE__).'/..'))); 
    20   $application->run(); 
     20  $statusCode = $application->run(); 
    2121} 
    2222catch (Exception $e) 
     
    2828 
    2929  $application->renderException($e); 
     30  $statusCode = $e->getCode(); 
    3031 
    31   exit(1); 
     32  exit(is_numeric($statusCode) && $statusCode ? $statusCode : 1); 
    3233} 
    3334 
    34 exit(0); 
     35exit(is_numeric($statusCode) ? $statusCode : 0); 
  • branches/1.1/test/other/tasksTest.php

    r7962 r8481  
    4747  } 
    4848 
    49   public function execute_command($cmd
     49  public function execute_command($cmd, $awaited_return=0
    5050  { 
    5151    $symfony = file_exists('symfony') ? 'symfony' : dirname(__FILE__).'/../../data/bin/symfony'; 
     
    5454    passthru(sprintf('%s -d html_errors=off -d open_basedir= -q "%s" %s 2>&1', $this->php_cli, $symfony, $cmd), $return); 
    5555    $content = ob_get_clean(); 
    56     $this->t->cmp_ok($return, '<=', 0, sprintf('"symfony %s" returns ok', $cmd)); 
     56    $this->t->cmp_ok($return, '==', $awaited_return, sprintf('"symfony %s" returns awaited value (%d)', $cmd, $awaited_return)); 
    5757 
    5858    return $content; 
     
    6565} 
    6666 
    67 $t = new lime_test(32, new lime_output_color()); 
     67$t = new lime_test(33, new lime_output_color()); 
    6868$c = new symfony_cmd(); 
    6969$c->initialize($t); 
     
    7575$content = $c->execute_command('generate:app frontend'); 
    7676$t->ok(is_dir($c->tmp_dir.DS.'apps'.DS.'frontend'), '"generate:app" creates a "frontend" directory under "apps" directory'); 
     77 
     78// failing 
     79$content = $c->execute_command('generate:module wrongapp foo', 1); 
    7780 
    7881$content = $c->execute_command('generate:module frontend foo');