path: python-stem_1.8.2-1.1/stem/util/system.py # # example output: # atagar@morrigan:~$ pidof vim # 3392 3283 path: python-stem_1.8.2-1.1/stem/util/system.py pass # attempts to resolve using pidof, failing if: # - we're running on bsd (command unavailable) # path: python-stem_1.8.2-1.1/stem/util/system.py # 3392 3283 if is_available('pidof'): results = call(GET_PID_BY_NAME_PIDOF % process_name, None) path: python-stem_1.8.2-1.1/stem/util/system.py 1. pgrep -x 2. pidof 3. ps -o pid -C (linux) ps axc | egrep " $" (bsd) path: python-stem_1.8.2-1.1/stem/util/system.py GET_NAME_BY_PID_PS = 'ps -p %s -o comm' GET_PID_BY_NAME_PGREP = 'pgrep -x %s' GET_PID_BY_NAME_PIDOF = 'pidof %s' GET_PID_BY_NAME_PS_LINUX = 'ps -o pid -C %s' GET_PID_BY_NAME_PS_BSD = 'ps axc' path: python-stem_1.8.2-1.1/test/integ/util/system.py @require_single_tor_instance @test.require.command('pidof') def test_pid_by_name_pidof(self): """ Tests the pid_by_name function with a pidof response. path: python-stem_1.8.2-1.1/test/integ/util/system.py def test_pid_by_name_pidof(self): """ Tests the pid_by_name function with a pidof response. """ path: python-stem_1.8.2-1.1/test/integ/util/system.py """ pidof_prefix = stem.util.system.GET_PID_BY_NAME_PIDOF % '' call_replacement = filter_system_call([pidof_prefix]) path: python-stem_1.8.2-1.1/test/integ/util/system.py pidof_prefix = stem.util.system.GET_PID_BY_NAME_PIDOF % '' call_replacement = filter_system_call([pidof_prefix]) with patch('stem.util.system.call') as call_mock: path: python-stem_1.8.2-1.1/test/integ/util/system.py @require_single_tor_instance @test.require.command('pidof') def test_pid_by_name_pidof(self): """ path: python-stem_1.8.2-1.1/test/unit/util/system.py def test_pid_by_name_pidof(self, call_mock): """ Tests the pid_by_name function with pidof responses. """ path: python-stem_1.8.2-1.1/test/unit/util/system.py @patch('stem.util.system.is_available', Mock(return_value = True)) @patch('stem.util.system.is_windows', Mock(return_value = False)) def test_pid_by_name_pidof(self, call_mock): """ Tests the pid_by_name function with pidof responses.