mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix not displaying output after cherry-pick fails
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
be2d19bbfb
commit
daad7e43fa
1
package-lock.json
generated
1
package-lock.json
generated
@ -34468,6 +34468,7 @@
|
|||||||
"version": "6.4.0-beta.13",
|
"version": "6.4.0-beta.13",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"chalk": "^5.2.0",
|
||||||
"inquirer": "^9.1.4",
|
"inquirer": "^9.1.4",
|
||||||
"semver": "^7.3.8"
|
"semver": "^7.3.8"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
"rimraf": "^4.1.2"
|
"rimraf": "^4.1.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"chalk": "^5.2.0",
|
||||||
"inquirer": "^9.1.4",
|
"inquirer": "^9.1.4",
|
||||||
"semver": "^7.3.8"
|
"semver": "^7.3.8"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
import chalk from "chalk";
|
||||||
import child_process from "child_process";
|
import child_process from "child_process";
|
||||||
import { readFile } from "fs/promises";
|
import { readFile } from "fs/promises";
|
||||||
import inquirer from "inquirer";
|
import inquirer from "inquirer";
|
||||||
import { EOL } from "os";
|
|
||||||
import { createInterface, ReadLine } from "readline";
|
import { createInterface, ReadLine } from "readline";
|
||||||
import semver from "semver";
|
import semver from "semver";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
@ -191,10 +191,38 @@ const isBugfixPr = (pr: ExtendedGithubPrData) => pr.labels.some(label => label.n
|
|||||||
|
|
||||||
const cherrypickCommitWith = (rl: ReadLine) => async (commit: string) => {
|
const cherrypickCommitWith = (rl: ReadLine) => async (commit: string) => {
|
||||||
try {
|
try {
|
||||||
await spawn("git", ["cherry-pick", commit], {
|
const cherryPick = child_process.spawn("git", ["cherry-pick", commit]);
|
||||||
stdio: "inherit",
|
|
||||||
|
cherryPick.stdout.pipe(process.stdout);
|
||||||
|
cherryPick.stderr.pipe(process.stderr);
|
||||||
|
|
||||||
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
const cleaners: (() => void)[] = [];
|
||||||
|
const cleanup = () => cleaners.forEach(cleaner => cleaner());
|
||||||
|
|
||||||
|
const onExit = (code: number | null) => {
|
||||||
|
if (code) {
|
||||||
|
reject(new Error(`git cherry-pick failed with exit code ${code}`));
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
cherryPick.once("exit", onExit);
|
||||||
|
cleaners.push(() => cherryPick.off("exit", onExit));
|
||||||
|
|
||||||
|
const onError = (error: Error) => {
|
||||||
|
cleanup();
|
||||||
|
reject(error);
|
||||||
|
};
|
||||||
|
|
||||||
|
cherryPick.once("error", onError);
|
||||||
|
cleaners.push(() => cherryPick.off("error", onError));
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
|
console.error(chalk.bold("Please resolve conflicts in a seperate terminal and then press enter here..."));
|
||||||
await new Promise<void>(resolve => rl.once("line", () => resolve()));
|
await new Promise<void>(resolve => rl.once("line", () => resolve()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -258,7 +286,6 @@ function formatChangelog(previousReleasedVersion: string, prs: ExtendedGithubPrD
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function cherrypickCommits(prs: ExtendedGithubPrData[]): Promise<void> {
|
async function cherrypickCommits(prs: ExtendedGithubPrData[]): Promise<void> {
|
||||||
console.log(`${EOL}If cherry-picking fails for any of these commits, please resolve them in a seperate terminal and then run "git cherry-pick --continue"${EOL}`);
|
|
||||||
const rl = createInterface(process.stdin);
|
const rl = createInterface(process.stdin);
|
||||||
const cherrypickCommit = cherrypickCommitWith(rl);
|
const cherrypickCommit = cherrypickCommitWith(rl);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user