livedesk 0.1.281 → 0.1.283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/livedesk.js
CHANGED
|
@@ -502,14 +502,22 @@ async function waitForManager(url = DEFAULT_MANAGER_URL, timeoutMs = 10000) {
|
|
|
502
502
|
return false;
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
function resolvePackageEntry(packageName, fallback) {
|
|
506
|
-
try {
|
|
507
|
-
return require.resolve(packageName);
|
|
508
|
-
} catch {
|
|
509
|
-
return require.resolve(fallback);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
505
|
+
function resolvePackageEntry(packageName, fallback) {
|
|
506
|
+
try {
|
|
507
|
+
return require.resolve(packageName);
|
|
508
|
+
} catch {
|
|
509
|
+
return require.resolve(fallback);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function quoteWindowsCommandArg(value) {
|
|
514
|
+
const text = String(value ?? '');
|
|
515
|
+
if (/^[A-Za-z0-9@._:/=+-]+$/.test(text)) {
|
|
516
|
+
return text;
|
|
517
|
+
}
|
|
518
|
+
return `"${text.replaceAll('"', '\\"')}"`;
|
|
519
|
+
}
|
|
520
|
+
|
|
513
521
|
async function runManager(args) {
|
|
514
522
|
const options = parseManagerArgs(args);
|
|
515
523
|
const httpPort = normalizePort(
|
|
@@ -559,8 +567,17 @@ async function runManager(args) {
|
|
|
559
567
|
|
|
560
568
|
const restartWithLatest = () => {
|
|
561
569
|
const npxCommand = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
562
|
-
const
|
|
563
|
-
|
|
570
|
+
const nextArgs = ['-y', '--prefer-online', 'livedesk@latest', 'hub', ...args];
|
|
571
|
+
const command = process.platform === 'win32' ? (process.env.ComSpec || 'cmd.exe') : npxCommand;
|
|
572
|
+
const commandArgs = process.platform === 'win32'
|
|
573
|
+
? ['/d', '/s', '/c', `call ${quoteWindowsCommandArg(npxCommand)} ${nextArgs.map(quoteWindowsCommandArg).join(' ')}`]
|
|
574
|
+
: nextArgs;
|
|
575
|
+
const next = spawn(command, commandArgs, {
|
|
576
|
+
env: {
|
|
577
|
+
...process.env,
|
|
578
|
+
LIVEDESK_NODE_EXECUTABLE: process.execPath,
|
|
579
|
+
LIVEDESK_NPX_EXECUTABLE: npxCommand
|
|
580
|
+
},
|
|
564
581
|
stdio: 'inherit',
|
|
565
582
|
detached: true,
|
|
566
583
|
windowsHide: false
|