From 435839a96d5e5fcbe1ad3edcc15ae546de2f3902 Mon Sep 17 00:00:00 2001 From: Sasha Goldshtein Date: Wed, 30 Mar 2016 13:25:09 -0700 Subject: [PATCH] Replaced `which --skip-alias` with `ProcUtils.which` --- tools/trace.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/trace.py b/tools/trace.py index fdcc3dd..aca1b27 100755 --- a/tools/trace.py +++ b/tools/trace.py @@ -9,7 +9,7 @@ # Licensed under the Apache License, Version 2.0 (the "License") # Copyright (C) 2016 Sasha Goldshtein. -from bcc import BPF, Tracepoint, Perf, USDTReader +from bcc import BPF, Tracepoint, Perf, ProcUtils, USDTReader from time import sleep, strftime import argparse import re @@ -416,10 +416,7 @@ BPF_PERF_OUTPUT(%s); libpath = BPF.find_library(self.library) if libpath is None: # This might be an executable (e.g. 'bash') - with os.popen( - "/usr/bin/which --skip-alias %s 2>/dev/null" % - self.library) as w: - libpath = w.read().strip() + libpath = ProcUtils.which(self.library) if libpath is None or len(libpath) == 0: self._bail("unable to find library %s" % self.library) -- 2.7.4