const { app, BrowserWindow, ipcMain } = require('electron');
const { exec } = require('child_process');
let mainWindow;
app.on('ready', () => {
mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});
mainWindow.loadFile('index.html');
});
ipcMain.on('run-command', (event, command) => {
exec(command, (err, stdout, stderr) => {
if (err) {
event.reply('command-result', `Hata: ${stderr}`);
} else {
event.reply('command-result', stdout);
}
});
});