feat 菜单功能

This commit is contained in:
2024-06-27 18:27:45 +08:00
parent e089376c09
commit e8aad4690c
3 changed files with 97 additions and 3 deletions
+12 -2
View File
@@ -22,9 +22,14 @@ function startServer() {
const args = ['./iyuu/windows.php'];
const workingDirectory = path.resolve(__dirname, '..');
const env = { ...process.env };
const phpDir = path.dirname(cmdPath);
env.PATH = `${phpDir}${path.delimiter}${env.PATH}`;
serverProcess = spawn(cmdPath, args, {
cwd: workingDirectory,
stdio: ['inherit', 'pipe', 'inherit']
stdio: ['inherit', 'pipe', 'inherit'],
env: env
});
serverProcess.stdout.setEncoding('utf8');
@@ -53,4 +58,9 @@ function stopServer() {
}
}
module.exports = { startServer, stopServer };
function restartServer() {
stopServer();
startServer();
}
module.exports = { startServer, stopServer, restartServer };