mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
一些小问题的修复
This commit is contained in:
@@ -279,7 +279,7 @@ export class KeyServiceMac {
|
|||||||
stdout += data
|
stdout += data
|
||||||
stdoutBuf += data
|
stdoutBuf += data
|
||||||
const parts = stdoutBuf.split(/\r?\n/)
|
const parts = stdoutBuf.split(/\r?\n/)
|
||||||
stdoutBuf = parts.pop() || ''
|
stdoutBuf = parts.pop()!
|
||||||
})
|
})
|
||||||
|
|
||||||
child.stderr.on('data', (chunk: Buffer | string) => {
|
child.stderr.on('data', (chunk: Buffer | string) => {
|
||||||
@@ -287,7 +287,7 @@ export class KeyServiceMac {
|
|||||||
stderr += data
|
stderr += data
|
||||||
stderrBuf += data
|
stderrBuf += data
|
||||||
const parts = stderrBuf.split(/\r?\n/)
|
const parts = stderrBuf.split(/\r?\n/)
|
||||||
stderrBuf = parts.pop() || ''
|
stderrBuf = parts.pop()!
|
||||||
for (const line of parts) processHelperLine(line.trim())
|
for (const line of parts) processHelperLine(line.trim())
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -358,13 +358,13 @@ export class KeyServiceMac {
|
|||||||
const result = await execFileAsync('osascript', scriptLines.flatMap(line => ['-e', line]), {
|
const result = await execFileAsync('osascript', scriptLines.flatMap(line => ['-e', line]), {
|
||||||
timeout: waitMs + 20_000
|
timeout: waitMs + 20_000
|
||||||
})
|
})
|
||||||
stdout = result.stdout || ''
|
stdout = result.stdout
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
const msg = `${e?.stderr || ''}\n${e?.stdout || ''}\n${e?.message || ''}`.trim()
|
const msg = `${e?.stderr || ''}\n${e?.stdout || ''}\n${e?.message || ''}`.trim()
|
||||||
throw new Error(msg || 'elevated helper execution failed')
|
throw new Error(msg || 'elevated helper execution failed')
|
||||||
}
|
}
|
||||||
|
|
||||||
const lines = String(stdout || '').split(/\r?\n/).map(x => x.trim()).filter(Boolean)
|
const lines = String(stdout).split(/\r?\n/).map(x => x.trim()).filter(Boolean)
|
||||||
const last = lines[lines.length - 1]
|
const last = lines[lines.length - 1]
|
||||||
if (!last) throw new Error('elevated helper returned empty output')
|
if (!last) throw new Error('elevated helper returned empty output')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user