diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-30 14:19:32 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2019-08-30 14:19:32 +0200 |
| commit | 5ae63c71fcbabad8ad5a3a13d7fc19493c1cc1c5 (patch) | |
| tree | fb8bf312fe439bde06339c94be116269aba0e04a /src/facter.py | |
| parent | 52c50b7299efb2050794ac589902af325156f7c3 (diff) | |
| download | allocbench-5ae63c71fcbabad8ad5a3a13d7fc19493c1cc1c5.tar.gz allocbench-5ae63c71fcbabad8ad5a3a13d7fc19493c1cc1c5.zip | |
try to get version of benchmark requirements
Diffstat (limited to 'src/facter.py')
| -rw-r--r-- | src/facter.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/facter.py b/src/facter.py index 8e01142..387c75c 100644 --- a/src/facter.py +++ b/src/facter.py @@ -25,6 +25,7 @@ import platform import subprocess import src.globalvars as gv +from src.util import print_error def collect_facts(): @@ -108,3 +109,14 @@ def libc_ver(executable=None): return platform.libc_ver(executable) return ("glibc", glibc_version) + +def exec_ver(executable): + """Return version of executable""" + proc = subprocess.run([executable, "--version"], + universal_newlines=True, stdout=subprocess.PIPE) + + if proc.returncode != 0: + print_error(f"failed to get version of {executable}") + return "" + + return proc.stdout[:-1] |
