@wu529778790/open-im 1.2.3-beta.1 → 1.2.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +6 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -79,7 +79,7 @@ async function validateOrSetup() {
|
|
|
79
79
|
// ============================================================================
|
|
80
80
|
// 命令处理
|
|
81
81
|
// ============================================================================
|
|
82
|
-
async function cmdStart() {
|
|
82
|
+
async function cmdStart(skipPlatformPrompt = false) {
|
|
83
83
|
const pid = getPid();
|
|
84
84
|
if (pid && isRunning(pid)) {
|
|
85
85
|
console.log(`open-im 已在后台运行 (pid=${pid})`);
|
|
@@ -90,8 +90,9 @@ async function cmdStart() {
|
|
|
90
90
|
process.exit(1);
|
|
91
91
|
}
|
|
92
92
|
// 有 TTY 时在父进程让用户选择要启用的平台,再启动子进程
|
|
93
|
+
// skipPlatformPrompt 为 true 时跳过提示(用于 restart 命令)
|
|
93
94
|
let config = loadConfig();
|
|
94
|
-
if (process.stdin.isTTY) {
|
|
95
|
+
if (process.stdin.isTTY && !skipPlatformPrompt) {
|
|
95
96
|
const updated = await runPlatformSelectionPrompt(config);
|
|
96
97
|
if (!updated) {
|
|
97
98
|
console.log("已取消启动。");
|
|
@@ -162,15 +163,16 @@ async function cmdRestart() {
|
|
|
162
163
|
// 等待进程完全停止
|
|
163
164
|
for (let i = 0; i < 30; i++) {
|
|
164
165
|
await new Promise((r) => setTimeout(r, 100));
|
|
165
|
-
if (!
|
|
166
|
+
if (!isRunning(pid))
|
|
166
167
|
break;
|
|
167
168
|
}
|
|
169
|
+
console.log("open-im 已停止");
|
|
168
170
|
}
|
|
169
171
|
else {
|
|
170
172
|
console.log("open-im 未在后台运行");
|
|
171
173
|
}
|
|
172
174
|
console.log("正在启动 open-im...");
|
|
173
|
-
await cmdStart();
|
|
175
|
+
await cmdStart(true); // 传递 true 跳过平台选择提示
|
|
174
176
|
}
|
|
175
177
|
async function cmdInit() {
|
|
176
178
|
console.log("\n━━━ open-im 配置向导 ━━━\n");
|