Fix "kill processes" function in evergreen.yml

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.5.6
    • Affects Version/s: 3.2.12, 3.4.2, 3.5.3
    • Component/s: Testing Infrastructure
    • Fully Compatible
    • ALL
    • v3.4, v3.2, v3.0
    • TIG 2017-04-17
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The "kill processes" function has a coding error:

      pgrep_list_full=$(pgrep -f --list-full ".*" 2>&1 > /dev/null)
      if [ -z "$pgrep_list_full" ]; then
      ...
      fi
      

      Since stdout & stderr are directed to /dev/null, this will always be true.

      Similarly, this test is also flawed:

      grep=grep
      grep_extended=$(echo "a" | $grep -E "(a)" 2>&1 > /dev/null)
      if [ ! -z "$grep_extended" ]; then
      ...
      fi
      

      The fix is to just direct stderr to /dev/null:

      pgrep_list_full=$(pgrep -f --list-full ".*" 2> /dev/null)
      if [ ! -z "$pgrep_list_full" ]; then
      ...
      fi
      ...
      grep_extended=$(echo "a" | $grep -E "(a)" 2> /dev/null)
      ...
      

      An alternate fix would be to test for $?

            Assignee:
            Jonathan Abrahams (Inactive)
            Reporter:
            Jonathan Abrahams (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: