dsh-desktop-enhance 0.9.0 → 0.9.1
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/lib/installer.mjs +7 -2
- package/package.json +1 -1
package/lib/installer.mjs
CHANGED
|
@@ -25,9 +25,10 @@ async function canonicalPath(path, mayCreate = false) {
|
|
|
25
25
|
if (await realpath(ancestor) !== ancestor) throw failure('INVALID_PATH')
|
|
26
26
|
return path
|
|
27
27
|
}
|
|
28
|
+
const cleanEnv = Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(?:ELECTRON_|DSH_|NODE_)/u.test(key)))
|
|
28
29
|
function run(command, args, timeoutMs = 30000) {
|
|
29
30
|
return new Promise(resolve => {
|
|
30
|
-
const child = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'] })
|
|
31
|
+
const child = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'], env: cleanEnv })
|
|
31
32
|
let stdout = '', stderr = ''
|
|
32
33
|
const timer = setTimeout(() => child.kill('SIGKILL'), timeoutMs)
|
|
33
34
|
child.stdout.on('data', chunk => { stdout += chunk })
|
|
@@ -84,7 +85,7 @@ async function handoff() {
|
|
|
84
85
|
}
|
|
85
86
|
async function appPids(app) {
|
|
86
87
|
const pattern = `${app}/Contents/`.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&')
|
|
87
|
-
const result = await run('pgrep', ['-f', pattern])
|
|
88
|
+
const result = await run('pgrep', ['-a', '-f', pattern])
|
|
88
89
|
if (result.code === 1) return []
|
|
89
90
|
if (result.code !== 0) throw failure('APP_QUERY_FAILED')
|
|
90
91
|
const pids = result.stdout.trim().split('\n').filter(Boolean).map(Number)
|
|
@@ -142,6 +143,10 @@ async function install(input, emit) {
|
|
|
142
143
|
if (replaced) {
|
|
143
144
|
if (await exists(input.failed)) throw failure('ROLLBACK_RESTORE_FAILED')
|
|
144
145
|
await rename(input.app, input.failed)
|
|
146
|
+
try {
|
|
147
|
+
const staging = await lstat(input.stageDir)
|
|
148
|
+
if (staging.dev === input.stagingDirectory.dev && staging.ino === input.stagingDirectory.ino && await realpath(input.stageDir) === input.stageDir) await rm(input.stageDir, { recursive: true })
|
|
149
|
+
} catch {}
|
|
145
150
|
}
|
|
146
151
|
if (backedUp) await rename(input.backup, input.app)
|
|
147
152
|
} catch { return { ok: false, code: 'ROLLBACK_RESTORE_FAILED' } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-desktop-enhance",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "DSH Desktop 界面增强:页内查找(Cmd+F)、轮次编号、上下文压缩行常显、建议、每步耗时、折叠文件夹状态计数、会话信息(含上下文注入 C1 视图)、工具管理、Skill 管理、独立远程接入与手机体验,以及智能建议、会话能力和远程接入的持久诊断日志。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "./icon.svg",
|