const Constants = require('../../constants');
const os = require('os');
const helpers = require('../../helpers');

const addListeners = (ipcMain, {closeApplication}) => {
  ipcMain.on(Constants.IPC_Reboot_System, () => {
    if (os.platform() === 'win32') {
      helpers.executeAsync('shutdown.exe', ['/r', '/t', '30']);
    }
    closeApplication();
  });
};

module.exports = {
  addListeners
};
