1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

try without pipe

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-05-12 11:11:00 -04:00
parent 11e1232691
commit 54b75e50b0

View File

@ -5,7 +5,7 @@
*/ */
// This script creates a release PR // This script creates a release PR
import { exec, spawn } from "child_process"; import { exec } from "child_process";
import commandLineArgs from "command-line-args"; import commandLineArgs from "command-line-args";
import fse from "fs-extra"; import fse from "fs-extra";
import { basename } from "path"; import { basename } from "path";
@ -190,35 +190,13 @@ await execP(`git push origin HEAD -u`);
const prBody = prBodyLines.join("\n"); const prBody = prBodyLines.join("\n");
const createPrArgs = [ const createPrArgs = [
"gh",
"pr", "pr",
"create", "create",
"--base", prBase, "--base", prBase,
"--title", `"Release ${newVersion.format()}"`, "--title", `"Release ${newVersion.format()}"`,
"--label", "skip-changelog", "--label", "skip-changelog",
"--body-file", "-", "--body", `"${prBody}"`,
]; ];
const createPrProcess = spawn("gh", createPrArgs, { stdio: "pipe", shell: true }); await execP(createPrArgs.join(" "), { shell: true });
let result = "";
let errorResult = "";
createPrProcess.stdout.on("data", (chunk) => result += chunk);
createPrProcess.stderr.on("data", (chunk) => errorResult += chunk);
createPrProcess.stdin.write(prBody);
createPrProcess.stdin.end();
await new Promise((resolve) => {
createPrProcess.on("close", () => {
createPrProcess.stdout.removeAllListeners();
resolve();
});
});
if (result) {
console.log(result);
}
if (errorResult) {
console.error(errorResult);
}