Changeset 168

Show
Ignore:
Timestamp:
05/25/08 14:18:53 (8 months ago)
Author:
iteman
Message:

- Adjusted to the "--growl-password" option.

Location:
trunk/bin
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/bin/specrunner

    r165 r168  
    5858function preload() 
    5959{ 
    60     $file = null; 
    61     for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
    62         if (!preg_match('/^-[^p]*p(.*)/', $_SERVER['argv'][$i], $matches)) { 
    63             continue; 
     60    do { 
     61        for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
     62            if ($_SERVER['argv'][$i] == '-p') { 
     63                $preloadFileIndex = $i + 1; 
     64                break 2; 
     65            } 
    6466        } 
    6567 
    66         if (!strlen($matches[1])) { 
    67             if ($i + 1 < $count) { 
    68                 $file = $_SERVER['argv'][ $i + 1 ]; 
    69                 break; 
    70             } 
    71         } else { 
    72             $file = $matches[1]; 
    73             break; 
    74         } 
     68        return; 
     69    } while (false); 
     70 
     71    if (!array_key_exists($preloadFileIndex, $_SERVER['argv'])) { 
     72        return; 
    7573    } 
    7674 
    77     if (!is_null($file)) { 
    78         $result = include_once $file; 
     75    $preloadFile = $_SERVER['argv'][$preloadFileIndex]; 
     76    if (!is_null($preloadFile)) { 
     77        $result = include_once $preloadFile; 
    7978        if (!$result) { 
    80             echo "ERROR: Cannot load [ $file ]. Make sure the file path and permission are correct.\n"; 
     79            echo "ERROR: Cannot load [ $preloadFile ]. Make sure the file path and permission are correct.\n"; 
    8180            exit(1); 
    8281        } 
  • trunk/bin/testrunner

    r165 r168  
    5858function preload() 
    5959{ 
    60     $file = null; 
    61     for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
    62         if (!preg_match('/^-[^p]*p(.*)/', $_SERVER['argv'][$i], $matches)) { 
    63             continue; 
     60    do { 
     61        for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
     62            if ($_SERVER['argv'][$i] == '-p') { 
     63                $preloadFileIndex = $i + 1; 
     64                break 2; 
     65            } 
    6466        } 
    6567 
    66         if (!strlen($matches[1])) { 
    67             if ($i + 1 < $count) { 
    68                 $file = $_SERVER['argv'][ $i + 1 ]; 
    69                 break; 
    70             } 
    71         } else { 
    72             $file = $matches[1]; 
    73             break; 
    74         } 
     68        return; 
     69    } while (false); 
     70 
     71    if (!array_key_exists($preloadFileIndex, $_SERVER['argv'])) { 
     72        return; 
    7573    } 
    7674 
    77     if (!is_null($file)) { 
    78         $result = include_once $file; 
     75    $preloadFile = $_SERVER['argv'][$preloadFileIndex]; 
     76    if (!is_null($preloadFile)) { 
     77        $result = include_once $preloadFile; 
    7978        if (!$result) { 
    80             echo "ERROR: Cannot load [ $file ]. Make sure the file path and permission are correct.\n"; 
     79            echo "ERROR: Cannot load [ $preloadFile ]. Make sure the file path and permission are correct.\n"; 
    8180            exit(1); 
    8281        } 
  • trunk/bin/testrunner-st

    r165 r168  
    5858function preload() 
    5959{ 
    60     $file = null; 
    61     for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
    62         if (!preg_match('/^-[^p]*p(.*)/', $_SERVER['argv'][$i], $matches)) { 
    63             continue; 
     60    do { 
     61        for ($i = 1, $count = count($_SERVER['argv']); $i < $count; ++$i) { 
     62            if ($_SERVER['argv'][$i] == '-p') { 
     63                $preloadFileIndex = $i + 1; 
     64                break 2; 
     65            } 
    6466        } 
    6567 
    66         if (!strlen($matches[1])) { 
    67             if ($i + 1 < $count) { 
    68                 $file = $_SERVER['argv'][ $i + 1 ]; 
    69                 break; 
    70             } 
    71         } else { 
    72             $file = $matches[1]; 
    73             break; 
    74         } 
     68        return; 
     69    } while (false); 
     70 
     71    if (!array_key_exists($preloadFileIndex, $_SERVER['argv'])) { 
     72        return; 
    7573    } 
    7674 
    77     if (!is_null($file)) { 
    78         $result = include_once $file; 
     75    $preloadFile = $_SERVER['argv'][$preloadFileIndex]; 
     76    if (!is_null($preloadFile)) { 
     77        $result = include_once $preloadFile; 
    7978        if (!$result) { 
    80             echo "ERROR: Cannot load [ $file ]. Make sure the file path and permission are correct.\n"; 
     79            echo "ERROR: Cannot load [ $preloadFile ]. Make sure the file path and permission are correct.\n"; 
    8180            exit(1); 
    8281        }