Skip to content

Commit 1980879

Browse files
committed
Let the buildbinary script run in non-git clone environments
1 parent acab1ef commit 1980879

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

package/buildbinary.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,21 @@ const binaryStagingInfoFile = binaryStagingFile + '-buildinfo.txt';
4141
// Build Metadata
4242
const buildDate = new Date();
4343
const nodeVersion = process.version;
44-
const njsGitSha = execSync('git --git-dir=./.git rev-parse --verify HEAD').toString().replace(/[\n\r]/, '');
45-
const odpiGitSha = execSync('git --git-dir=./odpi/.git rev-parse --verify HEAD').toString().replace(/[\n\r]/, '');
44+
45+
let njsGitSha;
46+
try {
47+
njsGitSha = execSync('git --git-dir=./.git rev-parse --verify HEAD').toString().replace(/[\n\r]/, '');
48+
} catch(e) {
49+
njsGitSha = 'unknown NJS SHA';
50+
}
51+
52+
let odpiGitSha;
53+
try {
54+
odpiGitSha = execSync('git --git-dir=./odpi/.git rev-parse --verify HEAD').toString().replace(/[\n\r]/, '');
55+
} catch(er) {
56+
odpiGitSha = 'unknown ODPI-C SHA';
57+
}
58+
4659
const buildInfo = nodbUtil.BINARY_FILE + ' ' + nodeVersion + ' ' + njsGitSha + ' ' + odpiGitSha + ' ' + buildDate.toUTCString();
4760

4861
// Build a binary for the current version of Node.js and move it to the Staging directory

0 commit comments

Comments
 (0)