Skip to content

Commit acc2401

Browse files
committed
Display server version at startup when not running from git repository
1 parent 217e8e3 commit acc2401

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/lib/cli.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,15 @@ function getVersion () {
2525
// Obtain version from git
2626
const options = { cwd: __dirname, encoding: 'utf8' }
2727
const { stdout } = spawnSync('git', ['describe', '--tags'], options)
28-
return stdout.trim()
28+
const version = stdout.trim()
29+
if (version === '') {
30+
throw new Error('No git version here')
31+
}
32+
return version
2933
} catch (e) {
3034
// Obtain version from package.json
3135
const { version } = require(path.join(__dirname, '../../package.json'))
3236
return version
3337
}
3438
}
39+

0 commit comments

Comments
 (0)