Provide the architecture in the environment

When writing an extension, we might want to download things differently (e.g. using the correct architecture when downloading a language server from github, or when selecting the appropriate path for some utilities in homebrew) based on the x86_64 vs arm64 difference.

On the one hand, its not hard to write some code to collect this via uname. But on the other hand, this would be trivial provide – just stash uname -m output in a property on the nova object (e.g. nova.arch could be arm64 or x86_64).

This would be cool, because collecting the output from uname -m is kind of annoying as you have to to use a callback, trim, and it’s gonna be slower than the system call. Also, you might need a promise to do it properly, since the command runs asynchronously, which adds complexity. Here’s my version of the code where I basically punt on the asynchronicity:

// We need to figure out what CPU architecture we are on
let cpu = "";
var process = new Process("/usr/bin/uname", { args: ["-m"] });
process.onStdout((line) => {
  cpu = line.trim();

function getCpu() {
  return cpu;

Wouldn’t that be so much better with just an access to nova.arch ?

1 Like