From 1d83845aa84de81e71a1a144ca656fbbd9cbb583 Mon Sep 17 00:00:00 2001 From: Malo Rosemeier <malo.rosemeier@iwes.fraunhofer.de> Date: Tue, 25 Jul 2017 09:05:32 +0200 Subject: [PATCH] check whether xvfb is installed --- finstrip_wrapper/core/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/finstrip_wrapper/core/main.py b/finstrip_wrapper/core/main.py index e2d2483..9ecd218 100644 --- a/finstrip_wrapper/core/main.py +++ b/finstrip_wrapper/core/main.py @@ -6,6 +6,11 @@ import commands import sys +def cmd_exists(cmd): + return subprocess.call("type " + cmd, shell=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 + + class FINSTRIPWrapper(object): ''' A basic wrapper for FINSTRIP that provides three primary functionalities: @@ -76,6 +81,11 @@ class FINSTRIPWrapper(object): ''' status('FINSTRIPWrapper: Start FINSTRIP execution') + # check if xvfb is installed + if not cmd_exists('xvfb-run'): + raise RuntimeError( + 'xvfb is not installed on the system. Please do sudo apt-get install xvfb') + self.finstrip_work_dir = os.getcwd() # create execution command cmd_list = [ -- GitLab