Check if OS is Windows when getting shared lib path
This commit is contained in:
parent
45cb575467
commit
6dde4bd3f2
1 changed files with 9 additions and 4 deletions
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
"""Module for the Trace action."""
|
"""Module for the Trace action."""
|
||||||
|
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import List
|
from typing import List
|
||||||
|
@ -73,10 +74,12 @@ class Trace(Action):
|
||||||
self.__ld_preload_action = None
|
self.__ld_preload_action = None
|
||||||
if self.has_profiling_events(events_ust):
|
if self.has_profiling_events(events_ust):
|
||||||
profile_lib_name = self.PROFILE_LIB_FAST if profile_fast else self.PROFILE_LIB_NORMAL
|
profile_lib_name = self.PROFILE_LIB_FAST if profile_fast else self.PROFILE_LIB_NORMAL
|
||||||
self.__ld_preload_action = SetEnvironmentVariable(
|
profile_lib_path = self.get_shared_lib_path(profile_lib_name)
|
||||||
'LD_PRELOAD',
|
if profile_lib_path is not None:
|
||||||
self.get_shared_lib_path(profile_lib_name),
|
self.__ld_preload_action = SetEnvironmentVariable(
|
||||||
)
|
'LD_PRELOAD',
|
||||||
|
profile_lib_path,
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def has_profiling_events(cls, events_ust: List[str]) -> bool:
|
def has_profiling_events(cls, events_ust: List[str]) -> bool:
|
||||||
|
@ -91,6 +94,8 @@ class Trace(Action):
|
||||||
:param lib_name: the name of the shared library
|
:param lib_name: the name of the shared library
|
||||||
:return: the full path if found, `None` otherwise
|
:return: the full path if found, `None` otherwise
|
||||||
"""
|
"""
|
||||||
|
if os.name == 'nt':
|
||||||
|
return None
|
||||||
(exit_code, output) = subprocess.getstatusoutput(f'whereis -b {lib_name}')
|
(exit_code, output) = subprocess.getstatusoutput(f'whereis -b {lib_name}')
|
||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue