Create tracing_supported() util function
This commit is contained in:
parent
cd4f8d5d08
commit
c0b86bd4db
2 changed files with 14 additions and 2 deletions
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
"""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
|
||||||
|
@ -26,6 +25,7 @@ from launch.actions import SetEnvironmentVariable
|
||||||
from launch.event import Event
|
from launch.event import Event
|
||||||
from launch.event_handlers import OnShutdown
|
from launch.event_handlers import OnShutdown
|
||||||
from launch.launch_context import LaunchContext
|
from launch.launch_context import LaunchContext
|
||||||
|
from tracetools_trace import tracing_supported
|
||||||
from tracetools_trace.tools import lttng
|
from tracetools_trace.tools import lttng
|
||||||
from tracetools_trace.tools import names
|
from tracetools_trace.tools import names
|
||||||
from tracetools_trace.tools import path
|
from tracetools_trace.tools import path
|
||||||
|
@ -94,7 +94,7 @@ 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':
|
if not tracing_supported():
|
||||||
return None
|
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:
|
||||||
|
|
|
@ -11,3 +11,15 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Module for tracing."""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def tracing_supported() -> bool:
|
||||||
|
"""
|
||||||
|
Check if tracing is supported on this platform.
|
||||||
|
It does not mean a tracer is installed.
|
||||||
|
"""
|
||||||
|
return sys.platform == 'linux'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue