|
1 |
| -import { spawn } from 'node:child_process'; |
2 | 1 | import path from 'node:path';
|
3 | 2 | import { promises as fs } from 'node:fs';
|
4 | 3 |
|
@@ -61,30 +60,22 @@ function doMinorUpdate() {
|
61 | 60 | }
|
62 | 61 |
|
63 | 62 | async function applyPatch(ctx, latestStr) {
|
64 |
| - const diff = spawn( |
| 63 | + const diff = await forceRunAsync( |
65 | 64 | 'git',
|
66 | 65 | ['format-patch', '--stdout', `${ctx.currentVersion}...${latestStr}`],
|
67 |
| - { cwd: ctx.v8Dir, stdio: ['ignore', 'pipe', 'ignore'] } |
| 66 | + { captureStdout: true, ignoreFailure: false, spawnArgs: { cwd: ctx.v8Dir } } |
68 | 67 | );
|
69 | 68 | try {
|
70 | 69 | await forceRunAsync('git', ['apply', '--directory', 'deps/v8'], {
|
| 70 | + input: diff, |
71 | 71 | ignoreFailure: false,
|
72 |
| - spawnArgs: { |
73 |
| - cwd: ctx.nodeDir, |
74 |
| - stdio: [diff.stdout, 'ignore', 'ignore'] |
75 |
| - } |
| 72 | + spawnArgs: { cwd: ctx.nodeDir } |
76 | 73 | });
|
77 | 74 | } catch (e) {
|
78 | 75 | const file = path.join(ctx.nodeDir, `${latestStr}.diff`);
|
79 | 76 | await fs.writeFile(file, diff);
|
80 | 77 | throw new Error(`Could not apply patch.\n${e}\nDiff was stored in ${file}`);
|
81 | 78 | }
|
82 |
| - if (diff.exitCode !== 0) { |
83 |
| - const err = new Error(`git format-patch failed: ${diff.exitCode}`); |
84 |
| - err.code = diff.exitCode; |
85 |
| - err.messageOnly = true; |
86 |
| - throw err; |
87 |
| - } |
88 | 79 | }
|
89 | 80 |
|
90 | 81 | function filterAndSortTags(tags) {
|
|
0 commit comments