-1

I need to detect MacOS Sierra and its version number using plain javascript. Please help me out with a code snippet.

lpradhap
  • 623
  • 6
  • 17

1 Answers1

0

try running child process with your command as below:

const { exec } = require("child_process");

 exec("system_profiler SPSoftwareDataType", (error, stdout, stderr) => {
    if (error) {
        console.log(`error: ${error.message}`);
        return;
    }
    if (stderr) {
        console.log(`stderr: ${stderr}`);
        return;
    }
    console.log(`stdout: ${stdout}`);
});
jaibalaji
  • 3,159
  • 2
  • 15
  • 28