From 180b94124cc17afa60cd9126fee2e004a26c43f2 Mon Sep 17 00:00:00 2001 From: Jean-Tiare Le Bigot Date: Fri, 15 May 2015 22:21:26 +0200 Subject: [PATCH] fix #7: use relative path to which Signed-off-by: Jean-Tiare Le Bigot --- CHANGELOG | 1 + cgroup_top.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cgroup_top.py b/cgroup_top.py index f073518..6a1ea66 100755 --- a/cgroup_top.py +++ b/cgroup_top.py @@ -41,7 +41,10 @@ sys.exit(0) def cmd_exists(cmd): - return subprocess.call(["/bin/which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + try: + return subprocess.call(["which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + except OSError: + return False HAS_LXC = cmd_exists('lxc-start') HAS_DOCKER = cmd_exists('docker')