MCPcopy
hub / github.com/peter-evans/create-pull-request / exec

Method exec

src/git-command-manager.ts:371–418  ·  view source on GitHub ↗
(
    args: string[],
    {
      encoding = 'utf8',
      allowAllExitCodes = false,
      suppressGitCmdOutput = false
    }: ExecOpts = {}
  )

Source from the content-addressed store, hash-verified

369 }
370
371 async exec(
372 args: string[],
373 {
374 encoding = 'utf8',
375 allowAllExitCodes = false,
376 suppressGitCmdOutput = false
377 }: ExecOpts = {}
378 ): Promise<GitOutput> {
379 const result = new GitOutput()
380
381 if (process.env['CPR_SHOW_GIT_CMD_OUTPUT']) {
382 // debug mode overrides the suppressGitCmdOutput option
383 suppressGitCmdOutput = false
384 }
385
386 const env = {}
387 for (const key of Object.keys(process.env)) {
388 env[key] = process.env[key]
389 }
390
391 const stdout: Buffer[] = []
392 let stdoutLength = 0
393 const stderr: Buffer[] = []
394 let stderrLength = 0
395
396 const options = {
397 cwd: this.workingDirectory,
398 env,
399 ignoreReturnCode: allowAllExitCodes,
400 listeners: {
401 stdout: (data: Buffer) => {
402 stdout.push(data)
403 stdoutLength += data.length
404 },
405 stderr: (data: Buffer) => {
406 stderr.push(data)
407 stderrLength += data.length
408 }
409 },
410 outStream: outStreamHandler(process.stdout, suppressGitCmdOutput),
411 errStream: outStreamHandler(process.stderr, suppressGitCmdOutput)
412 }
413
414 result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
415 result.stdout = Buffer.concat(stdout, stdoutLength).toString(encoding)
416 result.stderr = Buffer.concat(stderr, stderrLength).toString(encoding)
417 return result
418 }
419}
420
421class GitOutput {

Callers 15

checkoutMethod · 0.95
cherryPickMethod · 0.95
commitMethod · 0.95
configMethod · 0.95
configExistsMethod · 0.95
fetchMethod · 0.95
getCommitMethod · 0.95
getConfigValueMethod · 0.95
hasDiffMethod · 0.95
pushMethod · 0.95
revListMethod · 0.95
revParseMethod · 0.95

Calls 2

outStreamHandlerFunction · 0.85
pushMethod · 0.80

Tested by 3

createCommitsFunction · 0.64
afterTestFunction · 0.64
gitLogMatchesFunction · 0.64