Merge commit 'd4993fc780f98c06304c47a09c018b2f48f70926' into worktree/pr3596-global-only
This commit is contained in:
commit
27ec094db3
2 files changed
+5
-4
No files matched your search
@@ -284,7 +284,7 @@ export class PluginInstaller {
|
||||
const deadline = new AbortController()
|
||||
const signal = control === undefined ? deadline.signal : AbortSignal.any([deadline.signal, control.signal])
|
||||
const timer = setTimeout(() => { deadline.abort() }, config.installTimeoutMs)
|
||||
let exitCode: number | null
|
||||
let exitCode: number | null = null
|
||||
try {
|
||||
checkCancelled(control)
|
||||
const child = this.spawn({
|
||||
@@ -313,9 +313,9 @@ export class PluginInstaller {
|
||||
} catch (error) {
|
||||
const message = messageOf(error)
|
||||
record('stderr', `${message}\n`)
|
||||
this.options.installLog({ ...request, jobId, argv, cwd: profileDir, spec, stream: 'stderr', text: '', exitCode: null })
|
||||
this.options.installLog({ ...request, jobId, argv, cwd: profileDir, spec, stream: 'stderr', text: '', exitCode })
|
||||
if (error instanceof PluginOperationError && error.code === 'plugins/install-cancelled') throw error
|
||||
throw new PluginOperationError('plugins/install-failed', `${NAME}: ${message}`, { spec, exitCode: null, log: tail.join('') }, { cause: error })
|
||||
throw new PluginOperationError('plugins/install-failed', `${NAME}: ${message}`, { spec, exitCode, log: tail.join('') }, { cause: error })
|
||||
} finally {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ describe('PluginManager', () => {
|
||||
setInterval(() => {}, 1000);
|
||||
`)
|
||||
const ready = Promise.withResolvers<number>()
|
||||
const { ctx, manager } = await bootProfile(staged, {}, {
|
||||
const { ctx, manager, log } = await bootProfile(staged, {}, {
|
||||
pnpmCommand: process.execPath, installTimeoutMs: 30_000, installKillGraceMs: 50,
|
||||
})
|
||||
ctx.on('plugins/install-log', (chunk) => {
|
||||
@@ -704,6 +704,7 @@ describe('PluginManager', () => {
|
||||
expect(pid).toBeGreaterThan(0)
|
||||
expect(await manager.cancelInstall(requestId)).toEqual({ status: 'cancelled' })
|
||||
expect(await result).toMatchObject({ code: 'plugins/install-cancelled' })
|
||||
expect(log.at(-1)?.exitCode).toBe(0)
|
||||
// A reparented Linux child may remain a zombie until init reaps it; it cannot execute or write.
|
||||
let status = ''
|
||||
try { status = execFileSync('ps', ['-p', String(pid), '-o', 'stat='], { encoding: 'utf8' }).trim() } catch (error) {
|
||||
|
||||
Reference in new issue
Block a user