8
I’m starting in a desktop application with the use of Electron however I need to check if there is Git installed on the system because it must use git
As the idea is to distribute on Windows, Linux and Mac and the verification should occur to each "startup" of the application as I can check this on Linux and Mac?
What I have for now:
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;
}