Commit 4084c9a8 authored by 张聪's avatar 张聪

fix: 解决window打包问题

parent b78d05dd
Subproject commit e0ff31d4fbb58350c494658c5139eea740c8c376
Subproject commit 8ba75f2df36e055abd97f45f8c56f693c8a4b578
......@@ -4,7 +4,8 @@ const kill = require('kill-port')
const detect = require('detect-port');
const { MESSAGE_TYPE } = require('../enum')
const { getContext } = require('../store/index')
const { cwd } = require('../utils')
const { cwd,isMac } = require('../utils')
const log = getContext().log
const port = 7012
function killProcessServer(server, port) {
......@@ -21,17 +22,21 @@ function javaServer() {
const shellPath = path.join(cwd(), 'baseServer')
log.info('正在启动JAVA服务')
shell.cd(shellPath)
let exePath = path.join('.', '/jre/bin/java')
if (!isMac()){
exePath = exePath + '.exe'
}
log.info(shell.ls())
const child = shell.exec('./jre/bin/java -jar syc-paas-standalone-biz.jar -spring.config.location=file:./baseServer/config/boostrap.yml &', { async: true })
// const child = shell.exec('jre/bin/java -jar syc-paas-standalone-biz.jar -spring.config.location=file:./baseServer/config/boostrap.yml &', { async: true })
// const child = shell.exec('.\\jre\\bin\\java.exe -jar syc-paas-standalone-biz.jar -spring.config.location=file:./baseServer/config/boostrap.yml &', { async: true })
const child = shell.exec(exePath + ' -jar syc-paas-standalone-biz.jar -spring.config.location=file:./baseServer/config/boostrap.yml &', { async: true })
let isStart = false
child.stdout.on('data', function (stdout) {
log.info(stdout)
log.info(stdout,'----')
if (stdout.includes('Started Application in') && !isStart) {
process.parentPort.postMessage({
message: '成功',
start: true,
type: MESSAGE_TYPE.DEVELOPMENT
})
process.send('close')
isStart = true
}
})
......
......@@ -5,6 +5,7 @@ const { utilityProcess } = require('electron')
const { MESSAGE_TYPE } = require('../enum')
const { getContext } = require('../store')
const utils = require('../utils')
const {fork} = require('child_process')
// 执行进程命令,需使用nodejs启动,否则会不可控
class ProcessActivity {
......@@ -23,17 +24,24 @@ class ProcessActivity {
}
batchCommand(shellPath, args = [], cb) {
let forkParam = [shellPath]
if (args.length) {
forkParam = [shellPath, args]
}
const child = utilityProcess.fork(...forkParam)
// const child = utilityProcess.fork(...forkParam)
const child = fork(...forkParam)
child.on('message', (data) => {
const childParam = { data, child }
if (args.length || cb) {
return this.watchGlobalMsg(childParam, cb)
}
this.handleDefaultProcessEnd(childParam)
if (data === 'close'){
this.ctx.win.close()
}
})
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment