From f544b15eea9557ab754b6a6b212cf7b510e9d2d3 Mon Sep 17 00:00:00 2001 From: David Mehren Date: Sun, 3 Apr 2022 21:11:19 +0200 Subject: [PATCH] Ignore stderr when calling git executable This hopefully prevents confusing error messages in the docker image. Signed-off-by: David Mehren --- lib/config/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/config/utils.js b/lib/config/utils.js index c42bbd89f..cdb8f73ae 100644 --- a/lib/config/utils.js +++ b/lib/config/utils.js @@ -27,7 +27,10 @@ exports.toIntegerConfig = function toIntegerConfig (configValue) { exports.getGitCommit = function getGitCommit (repodir) { try { // prefer using git to get the current ref, as poking in .git is very fragile - return require('child_process').execSync('git rev-parse HEAD').replace('\n', '') + return require('child_process').execSync('git rev-parse HEAD', { + stdio: ['pipe', 'pipe', 'ignore'], + encoding: 'utf-8' + }).replace('\n', '') } catch (e) { // there was an error running git, try to parse refs ourselves if (!fs.existsSync(repodir + '/.git/HEAD')) {