Results 1 to 2 of 2

Thread: Patch to extend functionality of process checker

  1. #1
    Join Date
    Apr 2008
    Location
    York, UK
    Posts
    134

    Default Patch to extend functionality of process checker

    This patch allows applications with non-matching process names to be detected. It also accommodates distros that use different names for the same applications by allowing multiple process names to be set per application (see firefox and thunderbird changes).

    Code:
    diff --git a/pts-core/functions/pts-functions_system.php b/pts-core/functions/pts-functions_system.php
    index 81458af..e56c2b5 100644
    --- a/pts-core/functions/pts-functions_system.php
    +++ b/pts-core/functions/pts-functions_system.php
    @@ -15,9 +15,17 @@ function pts_process_running_string($process_arr)
            if(!is_array($process_arr))
                    $process_arr = array($process_arr);
    
    -       foreach($process_arr as $process)
    -               if(pts_process_running_bool($process))
    -                       array_push($p, $process);
    +       foreach($process_arr as $p_name => $p_process)
    +       {
    +               if(!is_array($p_process))
    +                       $p_process = array($p_process);
    +
    +               foreach($p_process as $process)
    +                       if(pts_process_running_bool($process))
    +                               array_push($p, $p_name);
    +       }
    +
    +       $p = array_keys(array_flip($p));
    
            if(($p_count = count($p)) > 0)
            {
    
    diff --git a/pts-core/pts-run-benchmark.php b/pts-core/pts-run-benchmark.php
    index b456fd7..60e65f7 100644
    --- a/pts-core/pts-run-benchmark.php
    +++ b/pts-core/pts-run-benchmark.php
    @@ -231,7 +231,13 @@ else
    
     if($SAVE_RESULTS)
     {
    -       $test_notes = pts_process_running_string(array("Compiz", "Firefox", "Thunderbird"));
    +       $running_process=array(
    +               "Compiz" => array("compiz"),
    +               "Firefox" => array("firefox","mozilla-firefox","mozilla-firefox-bin"),
    +               "Thunderbird" => array("thunderbird", "mozilla-thunderbird", "mozilla-thunderbird-bin")
    +       );
    +
    +       $test_notes = pts_process_running_string($running_process);
    
            if(defined("TEST_GRAPHICS"))
            {

  2. #2

    Default

    Committed to git, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •