Check whether avrdude is already running before starting another instance
This commit is contained in:
parent
f7ee5a1e0a
commit
ee932ce5e3
6
main.js
6
main.js
|
@ -8,6 +8,7 @@ const {execFile} = require('child_process');
|
|||
let win
|
||||
|
||||
var avrdudeErr = "";
|
||||
var avrdudeIsRunning = false;
|
||||
|
||||
function createWindow () {
|
||||
// Create the browser window.
|
||||
|
@ -57,6 +58,9 @@ ipcMain.on('download', (e, args) => {
|
|||
});
|
||||
|
||||
ipcMain.on('uploadFW', (e, args) => {
|
||||
|
||||
if(avrdudeIsRunning == true) { return; }
|
||||
avrdudeIsRunning = true; //Indicate that an avrdude process has started
|
||||
var platform;
|
||||
|
||||
var burnStarted = false;
|
||||
|
@ -107,9 +111,11 @@ ipcMain.on('uploadFW', (e, args) => {
|
|||
child.on('error', (err) => {
|
||||
console.log('Failed to start subprocess.');
|
||||
console.log(err);
|
||||
avrdudeIsRunning = false;
|
||||
});
|
||||
|
||||
child.on('close', (code) => {
|
||||
avrdudeIsRunning = false;
|
||||
if (code !== 0)
|
||||
{
|
||||
console.log(`avrdude process exited with code ${code}`);
|
||||
|
|
Loading…
Reference in New Issue