Read config before creating a workdir
authorJannis Harder <me@jix.one>
Tue, 5 Jul 2022 15:20:55 +0000 (17:20 +0200)
committerJannis Harder <me@jix.one>
Tue, 5 Jul 2022 15:20:55 +0000 (17:20 +0200)
When using a task name not defined in the config, this now produces an
error before creating an unnecessary workdir for that non-existing task.

sbysrc/sby.py

index b802b7a7959929a7ddb4e66c5de559827413ee35..0628c6d2d8ea4fa41b2353b3bdabd0b73f5e9df8 100644 (file)
@@ -402,6 +402,8 @@ if (workdir is not None) and (len(tasknames) != 1):
     sys.exit(1)
 
 def run_task(taskname):
+    sbyconfig, _, _, _ = read_sbyconfig(sbydata, taskname)
+
     my_opt_tmpdir = opt_tmpdir
     my_workdir = None
 
@@ -461,7 +463,6 @@ def run_task(taskname):
     else:
         junit_filename = "junit"
 
-    sbyconfig, _, _, _ = read_sbyconfig(sbydata, taskname)
     task = SbyTask(sbyconfig, my_workdir, early_logmsgs, reusedir)
 
     for k, v in exe_paths.items():