From c968c388d483dfe80014147bda6e766b78cd201f Mon Sep 17 00:00:00 2001 From: Abhilash Balaji Date: Thu, 17 Mar 2022 14:51:22 +0100 Subject: [PATCH] workaround for num_cpus returning 0 (#1034) workaround for num_cpus returning 0 --- src/output/details.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/output/details.rs b/src/output/details.rs index 9dca7d4..62ef7d8 100644 --- a/src/output/details.rs +++ b/src/output/details.rs @@ -147,7 +147,11 @@ impl<'a> AsRef> for Egg<'a> { impl<'a> Render<'a> { pub fn render(mut self, w: &mut W) -> io::Result<()> { - let mut pool = Pool::new(num_cpus::get() as u32); + let n_cpus = match num_cpus::get() as u32 { + 0 => 1, + n => n, + }; + let mut pool = Pool::new(n_cpus); let mut rows = Vec::new(); if let Some(ref table) = self.opts.table {