|
@@ -1,11 +1,13 @@
|
|
|
-import { BrowserWindow, ipcMain } from 'electron';
|
|
|
+import { BrowserWindow, ipcMain, app } from 'electron';
|
|
|
import { join } from 'path';
|
|
|
import { URL } from 'url';
|
|
|
import * as pty from 'node-pty';
|
|
|
import * as os from 'os';
|
|
|
|
|
|
+console.log('getAppPath', app.getAppPath());
|
|
|
|
|
|
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
|
|
|
+// const nodePath = os.platform() === 'win32' ? '.\\node_modules\\node\\bin\\node.exe' : './node_modules/node/bin/node';
|
|
|
|
|
|
interface ProcessEnv { [key: string]: string; }
|
|
|
|
|
@@ -55,8 +57,14 @@ async function createWindow() {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
+
|
|
|
const BenmarkFilePath = join(__dirname, '../../main/command/test.mjs');
|
|
|
- ptyProcess = pty.spawn(shell, [`node ${BenmarkFilePath}`, `${url}`, `${count}`], {
|
|
|
+
|
|
|
+ const nodePathProduction = join(process.resourcesPath, 'app/node_modules/node/bin/node.exe');
|
|
|
+ const nodePath = app.isPackaged ? nodePathProduction :'node';
|
|
|
+
|
|
|
+ // browserWindow.webContents.send('terminal.resourcesPath', app.isPackaged);
|
|
|
+ ptyProcess = pty.spawn(shell, [`${nodePath} ${BenmarkFilePath}`, `${url}`, `${count}`], {
|
|
|
name: 'xterm-color',
|
|
|
cols: 80,
|
|
|
rows: 30,
|