Skip to content

Commit 38a577d

Browse files
authored
fix(v8): clone V8 repository when it's not present (#756)
Previously, when the V8 repository was not present, it would emit an `'error'` event instead of rejecting the promise, causing the process to crash instead of running the fallback.
1 parent a9e0144 commit 38a577d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/run.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function runAsyncBase(cmd, args, {
3636
child.stdout.setEncoding('utf8');
3737
child.stdout.on('data', (chunk) => { stdout += chunk; });
3838
}
39+
child.on('error', reject);
3940
child.on('close', (code) => {
4041
if (code !== 0) {
4142
if (ignoreFailure) {

lib/update-v8/updateV8Clone.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { promises as fs } from 'node:fs';
33
import { Listr } from 'listr2';
44

55
import { v8Git } from './constants.js';
6-
import { runAsync } from '../run.js';
6+
import { forceRunAsync } from '../run.js';
77

88
export default function updateV8Clone() {
99
return {
@@ -19,7 +19,7 @@ function fetchOrigin() {
1919
title: 'Fetch V8',
2020
task: async(ctx, task) => {
2121
try {
22-
await runAsync('git', ['fetch', 'origin'], {
22+
await forceRunAsync('git', ['fetch', 'origin'], {
2323
spawnArgs: { cwd: ctx.v8Dir, stdio: 'ignore' }
2424
});
2525
} catch (e) {
@@ -39,8 +39,8 @@ function createClone() {
3939
title: 'Clone V8',
4040
task: async(ctx) => {
4141
await fs.mkdir(ctx.baseDir, { recursive: true });
42-
await runAsync('git', ['clone', v8Git], {
43-
spawnArgs: { cwd: ctx.baseDir, stdio: 'ignore' }
42+
await forceRunAsync('git', ['clone', v8Git, ctx.v8Dir], {
43+
spawnArgs: { stdio: 'ignore' }
4444
});
4545
},
4646
enabled: (ctx) => ctx.shouldClone

0 commit comments

Comments
 (0)