VirtualBox

Changeset 90643 in vbox for trunk


Ignore:
Timestamp:
Aug 12, 2021 7:29:32 AM (3 years ago)
Author:
vboxsync
Message:

Audio/ValKit: Don't use killall but grep'ing ps instead, as older Debians don't have killall out-of-the-box. Also should work on macOS. ​bugref:10008

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/audio/tdAudioTest.py

    r90517 r90643  
    3636import os
    3737import sys
     38import signal
    3839import subprocess
    3940import uuid
     
    213214            os.system('taskkill /IM "%s.exe" /F' % (sProcName));
    214215        else: # Note: killall is not available on older Debians (requires psmisc).
    215             os.system('kill -9 $(pidof %s)' % (sProcName));
     216            procPs = subprocess.Popen(['ps', 'ax'], stdout=subprocess.PIPE); # Using the BSD syntax here; MacOS also should understand this.
     217            out, _ = procPs.communicate();
     218            for sLine in out.decode("utf-8").splitlines():
     219                if sProcName in sLine:
     220                    pid = int(sLine.split(None, 1)[0]);
     221                    reporter.log2('Killing PID %d' % (pid,));
     222                    os.kill(pid, signal.SIGKILL);
    216223
    217224    def killHstVkat(self):
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette