"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.closeAppByName = closeAppByName; const child_process_1 = require("child_process"); const __1 = require("../"); function closeAppByName(appName) { try { // Get the process ID of the app by name const command = `tasklist /FI "IMAGENAME eq ${appName}.exe" /NH`; const output = (0, child_process_1.execSync)(command).toString(); const lines = output.split('\n'); const processIdLine = lines.find(line => line.includes(appName)); if (!processIdLine) { return; } const processId = parseInt(processIdLine.split(/\s+/)[1], 10); // Terminate the app process (0, child_process_1.execSync)(`taskkill /F /PID ${processId}`); } catch (error) { __1.logger.error(`Failed to close app '${appName}': ${error}`); } } //# sourceMappingURL=utils.js.map