MCPcopy Index your code
hub / github.com/remix-run/react-router / logAndExec

Function logAndExec

scripts/utils/process.ts:20–46  ·  view source on GitHub ↗
(
  commandOrArgs: string | string[],
  captureOutput = false,
)

Source from the content-addressed store, hash-verified

18export function logAndExec(args: string[], captureOutput?: boolean): string;
19export function logAndExec(command: string, captureOutput?: boolean): string;
20export function logAndExec(
21 commandOrArgs: string | string[],
22 captureOutput = false,
23): string {
24 let command: string;
25 if (typeof commandOrArgs === "string") {
26 command = commandOrArgs;
27 } else {
28 command = [
29 commandOrArgs[0],
30 // Quote each argument
31 ...commandOrArgs
32 .slice(1)
33 .map((arg) =>
34 arg.startsWith("-") ? arg : `'${arg.replaceAll("'", "'\\''")}'`,
35 ),
36 ].join(" ");
37 }
38
39 console.log(`$ ${command}`);
40 if (captureOutput) {
41 return cp.execSync(command, { stdio: "pipe", encoding: "utf-8" }).trim();
42 } else {
43 cp.execSync(command, { stdio: "inherit" });
44 return "";
45 }
46}

Callers 15

findBoundingTagsFunction · 0.90
getCommitsFunction · 0.90
commentOnIssueFunction · 0.90
findMergedPRsFunction · 0.90
getIssueLabelsFunction · 0.90
bumpVersionFunction · 0.90
publishPackagesFunction · 0.90
cleanupFunction · 0.90
branch.tsFile · 0.90
mainFunction · 0.90

Calls 1

logMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…