Fix empty revision case

This commit is contained in:
Felipe Knorr Kuhn 2022-03-23 12:33:15 -07:00
parent 4bb6f49950
commit 230fbdbc8e
No known key found for this signature in database
GPG Key ID: 79619B52BB097C1A

View File

@ -34,10 +34,9 @@ class BackendInfo {
} else {
try {
const gitRevParse = spawnSync('git', ['rev-parse', '--short', 'HEAD']);
if (!gitRevParse.error) {
this.gitCommitHash = gitRevParse.stdout.toString('utf-8').replace(/[\n\r\s]+$/, '');
console.log(`mempool revision ${this.gitCommitHash}`);
const output = gitRevParse.stdout.toString('utf-8').replace(/[\n\r\s]+$/, '');
this.gitCommitHash = output ? output : '?';
} else if (gitRevParse.error.code === 'ENOENT') {
console.log('git not found, cannot parse git hash');
this.gitCommitHash = '?';