I'm starting in a desktop application with the use of Electron however I need to check if there is Git installed in the system because it must necessarily use git
As the idea is to distribute in Windows, Linux and Mac and the verification should occur at every application startup how can I check this on Linux and Mac?
What I have by the hour:
const {
spawn,
spawnSync,
exec,
execSync,
execFileSync,
} = require('child_process')
switch(process.platform){
case'win32':
let git = spawn('cmd.exe', ['/c', 'git --version'])
git.stdout.on('data', (data) => {
// logic...
});
break;
case'linux':
//
break;
case'darwin':
//
break;
default:
// unsupported
break;
}