fix(async): prevent missed async errors from bypassing catch handlers (#13714)

Co-authored-by: Tommaso Sciortino <sciortino@gmail.com>
This commit is contained in:
CHAEWAN KIM
2025-12-02 07:11:40 +09:00
committed by GitHub
parent 0c463e664e
commit f4babf172b
25 changed files with 102 additions and 117 deletions

View File

@@ -22,10 +22,8 @@ vi.mock('./installationInfo.js', async () => {
};
});
vi.mock(
'./updateEventEmitter.js',
async (importOriginal) =>
await importOriginal<typeof import('./updateEventEmitter.js')>(),
vi.mock('./updateEventEmitter.js', async (importOriginal) =>
importOriginal<typeof import('./updateEventEmitter.js')>(),
);
interface MockChildProcess extends EventEmitter {

View File

@@ -191,7 +191,7 @@ export async function start_sandbox(
sandboxProcess = spawn(config.command, args, {
stdio: 'inherit',
});
return new Promise((resolve, reject) => {
return await new Promise((resolve, reject) => {
sandboxProcess?.on('error', reject);
sandboxProcess?.on('close', (code) => {
process.stdin.resume();
@@ -666,7 +666,7 @@ export async function start_sandbox(
stdio: 'inherit',
});
return new Promise<number>((resolve, reject) => {
return await new Promise<number>((resolve, reject) => {
sandboxProcess.on('error', (err) => {
coreEvents.emitFeedback('error', 'Sandbox process error', err);
reject(err);