Skip to content

Commit

Permalink
fix(v8): clone V8 repository when it's not present (#756)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aduh95 authored Nov 29, 2023
1 parent a9e0144 commit 38a577d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function runAsyncBase(cmd, args, {
child.stdout.setEncoding('utf8');
child.stdout.on('data', (chunk) => { stdout += chunk; });
}
child.on('error', reject);
child.on('close', (code) => {
if (code !== 0) {
if (ignoreFailure) {
Expand Down
8 changes: 4 additions & 4 deletions lib/update-v8/updateV8Clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { promises as fs } from 'node:fs';
import { Listr } from 'listr2';

import { v8Git } from './constants.js';
import { runAsync } from '../run.js';
import { forceRunAsync } from '../run.js';

export default function updateV8Clone() {
return {
Expand All @@ -19,7 +19,7 @@ function fetchOrigin() {
title: 'Fetch V8',
task: async(ctx, task) => {
try {
await runAsync('git', ['fetch', 'origin'], {
await forceRunAsync('git', ['fetch', 'origin'], {
spawnArgs: { cwd: ctx.v8Dir, stdio: 'ignore' }
});
} catch (e) {
Expand All @@ -39,8 +39,8 @@ function createClone() {
title: 'Clone V8',
task: async(ctx) => {
await fs.mkdir(ctx.baseDir, { recursive: true });
await runAsync('git', ['clone', v8Git], {
spawnArgs: { cwd: ctx.baseDir, stdio: 'ignore' }
await forceRunAsync('git', ['clone', v8Git, ctx.v8Dir], {
spawnArgs: { stdio: 'ignore' }
});
},
enabled: (ctx) => ctx.shouldClone
Expand Down

0 comments on commit 38a577d

Please sign in to comment.