]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Merge pull request #1176 from DaanDeMeyer/know-arg-stdout-devnull
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 8 Sep 2022 09:17:52 +0000 (11:17 +0200)
committerGitHub <noreply@github.com>
Thu, 8 Sep 2022 09:17:52 +0000 (11:17 +0200)
Send stdout to devnull when checking nspawn known arg

1  2 
mkosi/backend.py

index 911d6620c9d60718ca49cb2a9c98413295b56d6f,d5c31b347cefa3f6292e89b840bd0e4584e2ba26..4c5378213b0d0012888e041462a0ef280dfa9256
@@@ -657,8 -647,19 +657,13 @@@ def workspace(root: Path) -> Path
      return root.parent
  
  
 -def var_tmp(root: Path) -> Path:
 -    p = workspace(root) / "var-tmp"
 -    p.mkdir(exist_ok=True)
 -    return p
 -
 -
  def nspawn_knows_arg(arg: str) -> bool:
-     return "unrecognized option" not in run([nspawn_executable(), arg], stderr=subprocess.PIPE, check=False, text=True).stderr
+     # Specify some extra incompatible options so nspawn doesn't try to boot a container in the current
+     # directory if it has a compatible layout.
+     return "unrecognized option" not in run([nspawn_executable(), arg,
+                                             "--directory", "/dev/null", "--image", "/dev/null"],
+                                             stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, check=False,
+                                             text=True).stderr
  
  
  def format_rlimit(rlimit: int) -> str: