forked from Mirror/pmbootstrap
pmb.qemu: add ncpus fallback (MR 2252)
According to the type hints for os.cpu_count(), it might return None... To be safe, add a warning and a fallback in this case (though it seems incredibly unlikely this would ever be hit) Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
7ed08e74d3
commit
233cbdadeb
1 changed files with 3 additions and 0 deletions
|
@ -117,6 +117,9 @@ def command_qemu(args: PmbArgs, arch, img_path, img_path_2nd=None):
|
|||
raise RuntimeError("failed to find the proper vmlinuz path")
|
||||
|
||||
ncpus = os.cpu_count()
|
||||
if not ncpus:
|
||||
logging.warning("Couldn't get cpu count, defaulting to 4")
|
||||
ncpus = 4
|
||||
|
||||
# QEMU mach-virt's max CPU count is 8, limit it so it will work correctly
|
||||
# on systems with more than 8 CPUs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue