Skip to content

Commit

Permalink
fix: resolve symlink to bin script
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kovalev committed Feb 28, 2020
1 parent 68c9e77 commit 99ffff1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/luster.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env node
const /** @type {ClusterProcess} */
luster = require('../lib/luster'),
fs = require('fs'),
path = require('path');

// config path is right after this script in process.argv
const scriptArgvIndex = process.argv.findIndex(arg => arg === __filename || path.resolve(arg) === __filename);
// path in the argument may be relative or symlink
const scriptArgvIndex = process.argv.findIndex(arg => arg === __filename || fs.realpathSync(path.resolve(arg)) === __filename);
const configFilePath = path.resolve(process.cwd(), process.argv[scriptArgvIndex + 1] || 'luster.conf');

luster.configure(require(configFilePath), true, path.dirname(configFilePath)).run();

0 comments on commit 99ffff1

Please sign in to comment.