From 0985456df17fe59509416f963a09d4e9974606ad Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Sun, 8 Dec 2024 21:38:32 -0500 Subject: [PATCH] fix: don't use process as variable name --- lib/Git.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/Git.js b/lib/Git.js index a4346bd..af83d3d 100644 --- a/lib/Git.js +++ b/lib/Git.js @@ -449,23 +449,23 @@ class Git { logger.debug(`${this.command} ${commandArgs.join(' ')}`); if (execOptions.spawn) { - const process = child_process.spawn(this.command, commandArgs, execOptions); + const gitProcess = child_process.spawn(this.command, commandArgs, execOptions); if (execOptions.passthrough) { - process.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.info(line.trimEnd()))); - process.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.error(line.trimEnd()))); + gitProcess.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.info(line.trimEnd()))); + gitProcess.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.error(line.trimEnd()))); } else { if (execOptions.onStdout) { - process.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStdout(line.trimEnd()))); + gitProcess.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStdout(line.trimEnd()))); } if (execOptions.onStderr) { - process.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStderr(line.trimEnd()))); + gitProcess.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStderr(line.trimEnd()))); } } if (execOptions.wait) { return new Promise((resolve, reject) => { - process.on('exit', code => { + gitProcess.on('exit', code => { if (code == 0) { resolve(); } else { @@ -476,20 +476,20 @@ class Git { } let capturePromise; - process.captureOutput = (input = null) => { + gitProcess.captureOutput = (input = null) => { if (!capturePromise) { capturePromise = new Promise((resolve, reject) => { let output = '', error = ''; - process.stdout.on('data', data => { + gitProcess.stdout.on('data', data => { output += data; }); - process.stderr.on('data', data => { + gitProcess.stderr.on('data', data => { error += data; }); - process.on('close', code => { + gitProcess.on('close', code => { if (code == 0) { resolve(output); } else { @@ -504,18 +504,18 @@ class Git { } if (input) { - process.stdin.write(input); - process.stdin.end(); + gitProcess.stdin.write(input); + gitProcess.stdin.end(); } return capturePromise; }; - process.captureOutputTrimmed = async (input = null) => { - return (await process.captureOutput(input)).trim(); + gitProcess.captureOutputTrimmed = async (input = null) => { + return (await gitProcess.captureOutput(input)).trim(); }; - return process; + return gitProcess; } else if (execOptions.shell) { return new Promise((resolve, reject) => { child_process.exec(`${this.command} ${commandArgs.join(' ')}`, execOptions, (error, stdout, stderr) => {