Fix crash of BenchExec on non-Linux systems even before help screen is shown
BenchExec is not supported on other OS, but we might want to at least
show the help screen, and we want to support using different executors
instead of local execution also on other OS.
@@ -33,7 +33,6 @@ import time
from benchexec import __version__
from benchexec.model import Benchmark
-from benchexec import containerexecutor
from benchexec.outputhandler import OutputHandler
from benchexec import util
@@ -214,6 +213,14 @@ class BenchExec(object):
action="version",
version="%(prog)s " + __version__)
+ try:
+ from benchexec import containerexecutor
+ except Exception:
+ # This fails e.g. on MacOS X because of missing libc.
+ # We want to keep BenchExec usable for cases where the
+ # localexecutor is replaced by something else.
+ logging.debug("Could not import container feature:", exc_info=1)
+ else:
container_args = parser.add_argument_group("optional arguments for run container")
container_on_args = container_args.add_mutually_exclusive_group()
container_on_args.add_argument("--container", action='store_true',
