@fyresmith/hive-server 2.0.2-beta.0 → 2.2.0
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/cli/main.js +13 -2
- package/cli/tunnel.js +18 -2
- package/package.json +1 -1
package/cli/main.js
CHANGED
|
@@ -703,6 +703,11 @@ export async function runCli(argv = process.argv) {
|
|
|
703
703
|
registerTunnelCommands(program);
|
|
704
704
|
registerServiceCommands(program);
|
|
705
705
|
|
|
706
|
+
if ((argv?.length ?? 0) <= 2) {
|
|
707
|
+
program.outputHelp();
|
|
708
|
+
return EXIT.OK;
|
|
709
|
+
}
|
|
710
|
+
|
|
706
711
|
program.exitOverride();
|
|
707
712
|
|
|
708
713
|
try {
|
|
@@ -710,7 +715,13 @@ export async function runCli(argv = process.argv) {
|
|
|
710
715
|
return EXIT.OK;
|
|
711
716
|
} catch (err) {
|
|
712
717
|
if (err instanceof CommanderError) {
|
|
713
|
-
if (
|
|
718
|
+
if (
|
|
719
|
+
err.code === 'commander.helpDisplayed'
|
|
720
|
+
|| err.code === 'commander.help'
|
|
721
|
+
|| err.message === '(outputHelp)'
|
|
722
|
+
) {
|
|
723
|
+
return EXIT.OK;
|
|
724
|
+
}
|
|
714
725
|
throw new CliError(err.message, err.exitCode ?? EXIT.FAIL);
|
|
715
726
|
}
|
|
716
727
|
throw err;
|
|
@@ -720,7 +731,7 @@ export async function runCli(argv = process.argv) {
|
|
|
720
731
|
export async function runCliOrExit(argv = process.argv) {
|
|
721
732
|
try {
|
|
722
733
|
const code = await runCli(argv);
|
|
723
|
-
process.
|
|
734
|
+
process.exitCode = code;
|
|
724
735
|
} catch (err) {
|
|
725
736
|
const exitCode = err instanceof CliError ? err.exitCode : EXIT.FAIL;
|
|
726
737
|
const message = err instanceof Error ? err.message : String(err);
|
package/cli/tunnel.js
CHANGED
|
@@ -163,8 +163,24 @@ export async function installCloudflaredService() {
|
|
|
163
163
|
export async function cloudflaredServiceStatus() {
|
|
164
164
|
const platform = detectPlatform();
|
|
165
165
|
if (platform === 'darwin') {
|
|
166
|
-
const
|
|
167
|
-
|
|
166
|
+
const userList = await run('launchctl', ['list']).catch(() => ({ stdout: '' }));
|
|
167
|
+
if (userList.stdout.toLowerCase().includes('cloudflared')) {
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const systemLabel = 'com.cloudflare.cloudflared';
|
|
172
|
+
const systemPrint = await run('launchctl', ['print', `system/${systemLabel}`])
|
|
173
|
+
.catch((err) => ({ stdout: err?.stdout ?? '', stderr: err?.stderr ?? '' }));
|
|
174
|
+
const combined = `${systemPrint.stdout}\n${systemPrint.stderr}`.toLowerCase();
|
|
175
|
+
if (
|
|
176
|
+
combined
|
|
177
|
+
&& !combined.includes('could not find service')
|
|
178
|
+
&& !combined.includes('service does not exist')
|
|
179
|
+
) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return existsSync('/Library/LaunchDaemons/com.cloudflare.cloudflared.plist');
|
|
168
184
|
}
|
|
169
185
|
const { stdout } = await run('systemctl', ['is-active', 'cloudflared']);
|
|
170
186
|
return stdout.trim() === 'active';
|