scripts: remove --skip-alias from which commands

--skip-alias is not supported in all versions of which.

While here, explicitly import CalledProcessError - some
versions of Python didn't seem to mind, but it's not
true for all versions.  Also print related error
messages to stderr instead of stdout - this helps
with debugging since in some tests the stdout is
redirected to a file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I7637adc36da6290ece28c77b3398185191347eef

Reviewed-on: https://review.gerrithub.io/423414
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2018-08-24 11:39:24 -07:00
parent 58be43c085
commit 92861ff5f8
2 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from subprocess import check_call, call, check_output, Popen, PIPE
from subprocess import check_call, call, check_output, Popen, PIPE, CalledProcessError
import re
import sys
import signal
@ -66,10 +66,10 @@ def main():
configure_devices(devices)
try:
fio_executable = check_output("which --skip-alias fio", shell=True).split()[0]
except subprocess.CalledProcessError as e:
print(e)
print("Can't find the fio binary, please install it.")
fio_executable = check_output("which fio", shell=True).split()[0]
except CalledProcessError as e:
sys.stderr.write(str(e))
sys.stderr.write("\nCan't find the fio binary, please install it.\n")
sys.exit(1)
device_paths = ['/dev/' + dev for dev in devices]

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
from subprocess import check_call, call, check_output, Popen, PIPE
from subprocess import check_call, call, check_output, Popen, PIPE, CalledProcessError
import re
import sys
import signal
@ -66,10 +66,10 @@ def main():
# configure_devices(devices)
try:
fio_executable = check_output("which --skip-alias fio", shell=True).split()[0]
except subprocess.CalledProcessError as e:
print(e)
print("Can't find the fio binary, please install it.")
fio_executable = check_output("which fio", shell=True).split()[0]
except CalledProcessError as e:
sys.stderr.write(str(e))
sys.stderr.write("\nCan't find the fio binary, please install it.\n")
sys.exit(1)
device_paths = ['/dev/' + dev for dev in devices]