workaround for num_cpus returning 0 (#1034)

workaround for num_cpus returning 0
This commit is contained in:
Abhilash Balaji 2022-03-17 14:51:22 +01:00 committed by GitHub
parent 42659f9345
commit c968c388d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,7 +147,11 @@ impl<'a> AsRef<File<'a>> for Egg<'a> {
impl<'a> Render<'a> {
pub fn render<W: Write>(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 {