From c00edfa48453b14a35a683c2bdc0c794dae8c154 Mon Sep 17 00:00:00 2001 From: naibo Date: Mon, 10 Jul 2023 11:12:24 +0800 Subject: [PATCH] for windows main.js --- ElectronJS/main.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ElectronJS/main.js b/ElectronJS/main.js index dce33e1..f668383 100644 --- a/ElectronJS/main.js +++ b/ElectronJS/main.js @@ -8,7 +8,7 @@ const {rootCertificates} = require('tls'); const {exit} = require('process'); const path = require('path'); const fs = require('fs'); -const {exec} = require('child_process'); +const {exec, spawn} = require('child_process'); const iconPath = path.join(__dirname, 'favicon.ico'); const task_server = require(path.join(__dirname, 'server.js')); const util = require('util'); @@ -333,14 +333,13 @@ async function beginInvoke(msg, ws) { // }); let spawn = require("child_process").spawn; - if (process.platform != "darwin" && msg.message.execute_type == 1) { + if (process.platform != "darwin" && msg.message.execute_type == 1 && msg.message.id != -1) { let child_process = spawn(execute_path, parameters); child_process.stdout.on('data', function (data) { console.log(data.toString()); }); - } else { - ws.send(JSON.stringify({"config_folder": task_server.getDir() + "/", "easyspider_location": task_server.getEasySpiderLocation()})); } + ws.send(JSON.stringify({"config_folder": task_server.getDir() + "/", "easyspider_location": task_server.getEasySpiderLocation()})); } else if (msg.type == 6) { try{ flowchart_window.openDevTools();