Development

Changeset 2382

You must first sign up to be able to contribute.

Changeset 2382

Show
Ignore:
Timestamp:
10/12/06 18:20:48 (2 years ago)
Author:
fabien
Message:

pake: added proper support for STDERR and status code return

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/pake/trunk/lib/pake/pakeColor.class.php

    r2042 r2382  
    3030  } 
    3131 
    32   static function colorize($text = '', $parameters = array()
     32  static function colorize($text = '', $parameters = array(), $stream = STDOUT
    3333  { 
    3434    // disable colors if not supported (windows or non tty console) 
    35     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' || !function_exists('posix_isatty') || !@posix_isatty(STDOUT)) 
     35    if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' || !function_exists('posix_isatty') || !@posix_isatty($stream)) 
    3636    { 
    3737      return $text; 
  • tools/pake/trunk/lib/pake/pakeException.class.php

    r1868 r2382  
    4242    $messages[] = str_repeat(' ', $len); 
    4343 
    44     echo "\n"
     44    fwrite(STDERR, "\n")
    4545    foreach ($messages as $message) 
    4646    { 
    47       echo pakeColor::colorize($message, 'ERROR')."\n"
     47      fwrite(STDERR, pakeColor::colorize($message, 'ERROR', STDERR)."\n")
    4848    } 
    49     echo "\n"
     49    fwrite(STDERR, "\n")
    5050 
    5151    $pake = pakeApp::get_instance(); 
     
    5353    if ($pake->get_trace()) 
    5454    { 
    55       echo "exception trace:\n"
     55      fwrite(STDERR, "exception trace:\n")
    5656 
    5757      $trace = $this->trace($e); 
     
    6464        $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a'; 
    6565 
    66         echo sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO'), pakeColor::colorize($line, 'INFO')); 
     66        fwrite(STDERR, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, pakeColor::colorize($file, 'INFO', STDERR), pakeColor::colorize($line, 'INFO', STDERR))); 
    6767      } 
    6868    } 
    6969 
    70     echo "\n"
     70    fwrite(STDERR, "\n")
    7171  } 
    7272 
  • tools/pake/trunk/lib/pake/pakeFunction.php

    r2006 r2382  
    393393  $e = new pakeException(); 
    394394  $e->render($exception); 
     395  exit(1); 
    395396} 
    396397set_exception_handler('pake_exception_default_handler');