From 20b341f8806f7c91812779d787b06f5bbffa66a8 Mon Sep 17 00:00:00 2001 From: Leonhard Reichenbach Date: Sun, 29 Sep 2024 22:09:57 +0200 Subject: [PATCH] Ensure ROOT is in batch mode (#207) Co-authored-by: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> --- k4FWCore/scripts/k4run | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/k4FWCore/scripts/k4run b/k4FWCore/scripts/k4run index 6ea509ad..c14efcce 100755 --- a/k4FWCore/scripts/k4run +++ b/k4FWCore/scripts/k4run @@ -148,6 +148,12 @@ def main(): help="Print all the configurable components available in the framework and exit", ) parser.add_argument("--gdb", action="store_true", help="Attach gdb debugger") + parser.add_argument( + "--interactive-root", + action="store_true", + help="Run with ROOT in interactive mode (e.g. to see plots)", + default=False, + ) # Once to parse the files and another time below to have the new parameters # in the namespace since parsing of the file happens when the namespace @@ -229,6 +235,11 @@ def main(): c = gaudimain() if not opts.dry_run: + if not opts.interactive_root: + from ROOT import gROOT + + gROOT.SetBatch(True) + # Do the real processing retcode = c.run(opts.gdb) # User requested stop returns non-zero exit code see: https://github.com/key4hep/k4FWCore/issues/125