Read-only mirror — the public repositories of the Forgejo instance, refreshed every 10 minutes. The live instance (fg.dieschoenewolke.de) is reachable only over the VPN; clone here with https://git.dieschoenewolke.de/git/<owner>/<repo>.git.
summaryrefslogtreecommitdiff
path: root/src/git-command-manager.ts
diff options
context:
space:
mode:
authorVallie Joseph <vmjoseph@github.com>2022-11-30 20:03:42 +0000
committerVallie Joseph <vmjoseph@github.com>2022-11-30 20:03:42 +0000
commita8f7cb6416e87946ead000af5355735c0d733e13 (patch)
treeb89fb9b8f93d024a1f9e7166931343c998a552de /src/git-command-manager.ts
parentd85afe8678967b401822621bca1c6b469814eacf (diff)
adding listener
Diffstat (limited to 'src/git-command-manager.ts')
-rw-r--r--src/git-command-manager.ts32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts
index 512377d..d150d0f 100644
--- a/src/git-command-manager.ts
+++ b/src/git-command-manager.ts
@@ -104,7 +104,12 @@ class GitCommandManager {
args.push('--branches')
}
- const output = await this.execGit(args)
+ const listeners = {
+ stderr: (data: Buffer) => {
+ core.debug(data.toString())
+ }
+ }
+ const output = await this.execGit(args, false, false, listeners)
for (let branch of output.stdout.trim().split('\n')) {
branch = branch.trim()
@@ -395,7 +400,8 @@ class GitCommandManager {
private async execGit(
args: string[],
allowAllExitCodes = false,
- silent = false
+ silent = false,
+ customListeners = {}
): Promise<GitOutput> {
fshelper.directoryExistsSync(this.workingDirectory, true)
@@ -408,22 +414,22 @@ class GitCommandManager {
for (const key of Object.keys(this.gitEnv)) {
env[key] = this.gitEnv[key]
}
-
- const stdout: string[] = ['ardvark']
-
+ const defaultListener = {
+ stdout: (data: Buffer) => {
+ stdout.push(data.toString())
+ }
+ }
+ // const listeners = Object.keys(customListeners) < 0 ? customListeners : {stdout: (data: Buffer) => {
+ // stdout.push(data.toString())
+ // }}
+ const listenersD = {...customListeners, ...defaultListener}
+ const stdout: string[] = []
const options = {
cwd: this.workingDirectory,
env,
silent,
ignoreReturnCode: allowAllExitCodes,
- listeners: {
- stdout: (data: Buffer) => {
- stdout.push(data.toString())
- },
- stderr: (data: Buffer) => {
- stdout.push(data.toString())
- }
- }
+ listeners: listenersD
}
result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)