mirror of https://github.com/calzoneman/sync.git
Fix version check in index.js to reject node <v6
This commit is contained in:
parent
fcfc45dd70
commit
34eaca7b84
17
index.js
17
index.js
|
@ -1,9 +1,12 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
if (/^v0/.test(process.version)) {
|
const ver = process.version.match(/v(\d+)\.\d+\.\d+/);
|
||||||
console.error('node.js ' + process.version + ' is not supported. ' +
|
|
||||||
'For more information, visit ' +
|
if (parseInt(ver[1], 10) < 6) {
|
||||||
'https://github.com/calzoneman/sync/wiki/CyTube-3.0-Installation-Guide#nodejs');
|
console.error(
|
||||||
|
`node.js ${process.version} is not supported. ` +
|
||||||
|
'CyTube requires node v6 or later.'
|
||||||
|
)
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +27,7 @@ function fork() {
|
||||||
try {
|
try {
|
||||||
console.log('Warning: --daemonize support is experimental. Use with caution.');
|
console.log('Warning: --daemonize support is experimental. Use with caution.');
|
||||||
|
|
||||||
const { spawn } = require('child_process');
|
const spawn = require('child_process').spawn;
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const main = path.resolve(__dirname, 'lib', 'main.js');
|
const main = path.resolve(__dirname, 'lib', 'main.js');
|
||||||
|
|
||||||
|
@ -62,9 +65,9 @@ function handleStartupError(err) {
|
||||||
|
|
||||||
function parseArgs() {
|
function parseArgs() {
|
||||||
const args = new Map();
|
const args = new Map();
|
||||||
for (let i = 2; i < process.argv.length; i++) {
|
for (var i = 2; i < process.argv.length; i++) {
|
||||||
if (/^--/.test(process.argv[i])) {
|
if (/^--/.test(process.argv[i])) {
|
||||||
let val;
|
var val;
|
||||||
if (i+1 < process.argv.length) val = process.argv[i+1];
|
if (i+1 < process.argv.length) val = process.argv[i+1];
|
||||||
else val = null;
|
else val = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue