提交 cc75f102 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

kill ztf process by electron

上级 ff439191
......@@ -17,15 +17,18 @@ let _ztfSubProcessIds = [];
export function checkZtfPort() {
let cmd = ''
if (!isWin) {
cmd = 'lsof -i:${port} | grep ${port}'
cmd = `lsof -i:${port} | grep :${port}`
} else {
cmd = 'netstat -aon | findstr ${port}'
cmd = `netstat -aon`
}
const stdout = execSync(cmd).toString().trim()
console.log('exec ${cmd}, stdout: ${stdout}');
const cp = require('child_process');
const stdout = cp.execSync(cmd).toString().trim()
const msg = `exec ${cmd}, stdout: ${stdout}`
console.log(msg);
logInfo(msg)
if (stdout.indexOf(port + '') > -1) {
if (stdout.indexOf(':' + port) > -1) {
if (stdout.indexOf(uuid) < 0) {
const msg = 'Port ${port} is used by another process. exit.'
console.log(msg);
......@@ -44,6 +47,11 @@ export function checkZtfPort() {
}
export function startZtfServer() {
const pass = checkZtfPort()
if (!pass) {
return
}
if (process.env.SKIP_SERVER) {
logInfo(`>> Skip to start ZTF Server by env "SKIP_SERVER=${process.env.SKIP_SERVER}".`);
return Promise.resolve();
......
......@@ -20,7 +20,6 @@
"localforage": "^1.10.0",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"monaco-editor": "^0.32.1",
"monaco-editor-webpack-plugin": "^7.0.1",
"neffos.js": "^0.1.25",
"nprogress": "^0.2.0",
......
......@@ -67,7 +67,7 @@ import {useI18n} from "vue-i18n";
// import hljsVuePlugin from "@highlightjs/vue-plugin";
// import 'highlight.js/styles/googlecode.css'
import * as monaco from 'monaco-editor';
// import * as monaco from 'monaco-editor';
interface ListScriptPageSetupData {
t: (key: string | number) => string;
......@@ -140,14 +140,14 @@ export default defineComponent({
console.log('expandNode', keys[0], e)
}
let monacoInstance: any
const disposeEditor = () => {
console.log('disposeEditor')
if (monacoInstance) monacoInstance.dispose();
}
// let monacoInstance: any
// const disposeEditor = () => {
// console.log('disposeEditor')
// if (monacoInstance) monacoInstance.dispose();
// }
onUnmounted(() => {
console.log('onUnmounted', tree)
disposeEditor()
// disposeEditor()
})
const selectNode = (selectedKeys, e) => {
console.log('selectNode', e.selectedNodes)
......@@ -159,11 +159,11 @@ export default defineComponent({
console.log('===', script)
scriptCode.value = script.value.code
disposeEditor()
monacoInstance = monaco.editor.create(document.getElementById("monaco") as HTMLElement,{
value: script.value.code,
language:"php"
})
// disposeEditor()
// monacoInstance = monaco.editor.create(document.getElementById("monaco") as HTMLElement,{
// value: script.value.code,
// language:"php"
// })
})
}
......
......@@ -2,6 +2,8 @@
const bodyParser = require('body-parser')
const { NODE_ENV, VUE_APP_PORT, VUE_APP_MOCK } = process.env;
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
module.exports = {
publicPath: '/',
outputDir: 'dist',
......@@ -72,5 +74,12 @@ module.exports = {
});
config.resolve.alias.set('vue-i18n', 'vue-i18n/dist/vue-i18n.cjs.js')
config.plugin('monaco-editor').use(MonacoWebpackPlugin, [
{
// Languages are loaded on demand at runtime
languages: ['json', 'javascript', 'html', 'xml']
}
])
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册