1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-17 18:44:45 +02:00

Tools: Fixes #2256: Better handling of git failure when building package-info

This commit is contained in:
Laurent Cozic 2020-01-24 23:10:24 +00:00
parent 715253da2f
commit 2657c8736e

View File

@ -20,10 +20,14 @@ packageInfo.build = { appId: appId };
let branch;
let hash;
try {
branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
hash = execSync('git log --pretty="%h" -1').toString().trim();
// Use stdio: 'pipe' so that execSync doesn't print error directly to stdout
branch = execSync('git rev-parse --abbrev-ref HEAD', {stdio: 'pipe' }).toString().trim();
hash = execSync('git log --pretty="%h" -1', {stdio: 'pipe' }).toString().trim();
} catch (err) {
console.warn('Could not get git info', err);
// Don't display error object as it's a "fatal" error, but
// not for us, since is it not critical information
// https://github.com/laurent22/joplin/issues/2256
console.info('Warning: Could not get git info (it will not be displayed in About dialog box)');
}
if (typeof branch !== 'undefined' && typeof hash !== 'undefined') {
packageInfo.git = { branch: branch, hash: hash };