bun icon indicating copy to clipboard operation
bun copied to clipboard

os.networkInterfaces and os.cpus return empty objects

Open OmgImAlexis opened this issue 1 year ago • 3 comments

What version of Bun is running?

0.3.0

What platform is your computer?

Darwin 20.6.0 Darwin Kernel Version 20.6.0: Tue Jun 21 20:50:28 PDT 2022; root:xnu-7195.141.32~1/RELEASE_X86_64 x86_64 i386

What steps can reproduce the bug?

import { cpus, networkInterfaces } from 'os';

console.log({
  cpus: cpus(),
  networkInterfaces: networkInterfaces(),
});

How often does it reproduce? Is there a required condition?

100% of the time, tested on both macos and linux.

What is the expected behavior?

{
  cpus: [
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    },
    {
      model: 'Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz',
      speed: 2500,
      times: [Object]
    }
  ],
  networkInterfaces: {
    lo0: [ [Object], [Object], [Object] ],
    en0: [ [Object], [Object] ],
    awdl0: [ [Object] ],
    llw0: [ [Object] ],
    utun0: [ [Object] ],
    utun1: [ [Object] ],
    utun2: [ [Object] ],
    utun3: [ [Object] ],
    utun4: [ [Object] ],
    utun5: [ [Object] ]
  }
}

What do you see instead?

{ cpus: [], networkInterfaces: { } }

Additional information

No response

OmgImAlexis avatar Nov 26 '22 02:11 OmgImAlexis

These functions aren't implemented yet. We removed an earlier implementation which was too buggy

Jarred-Sumner avatar Nov 26 '22 03:11 Jarred-Sumner

No worries, didn't see an issue or anything about this in the roadmap so figured I'd open an issue to track it.

OmgImAlexis avatar Nov 26 '22 04:11 OmgImAlexis

os.cpus is implemented but only for Linux at the moment

jwhear avatar Feb 15 '23 17:02 jwhear