I need to detect MacOS Sierra and its version number using plain javascript. Please help me out with a code snippet.
Asked
Active
Viewed 69 times
1 Answers
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