unbound-cli 1.1.6 → 1.1.7
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/package.json +1 -1
- package/src/commands/discover.js +16 -0
package/package.json
CHANGED
package/src/commands/discover.js
CHANGED
|
@@ -11,6 +11,13 @@ const LAUNCH_AGENT_LABEL = 'ai.getunbound.discovery';
|
|
|
11
11
|
// (e.g. Linux). Treated as a skipped scan, not a failure.
|
|
12
12
|
const DISCOVERY_EXIT_UNSUPPORTED_OS = 3;
|
|
13
13
|
|
|
14
|
+
// Self-imposed discovery run timeout (seconds), forwarded through install.sh to
|
|
15
|
+
// the discovery process so `unbound onboard` / `unbound discover` can't hang
|
|
16
|
+
// indefinitely. Discovery enforces this itself — on expiry it releases its lock,
|
|
17
|
+
// reports the run as failed, and exits non-zero. Kept in sync with
|
|
18
|
+
// setup/mdm/onboard.py's DISCOVERY_TIMEOUT_SECONDS.
|
|
19
|
+
const DISCOVERY_TIMEOUT_SECONDS = 1800;
|
|
20
|
+
|
|
14
21
|
// Classifies a discovery subprocess exit code:
|
|
15
22
|
// 'success' (scan ran), 'unsupported' (skipped on this OS), or 'failure'.
|
|
16
23
|
function classifyDiscoveryExit(code) {
|
|
@@ -146,7 +153,16 @@ async function runDiscoveryScan({ apiKey, domain }) {
|
|
|
146
153
|
console.log('');
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
// Don't pass --timeout: install.sh is fetched from coding-discovery-tool/main,
|
|
157
|
+
// and an older discovery there would reject the unknown flag (argparse exits
|
|
158
|
+
// non-zero) and fail the scan. Discovery self-bounds via its own default (kept
|
|
159
|
+
// equal to DISCOVERY_TIMEOUT_SECONDS), so this is correct regardless of merge
|
|
160
|
+
// order. Surface the bound so the wait isn't a mystery; on expiry the discovery
|
|
161
|
+
// process prints its own line (stdio is inherited) and exits non-zero.
|
|
149
162
|
const args = `--api-key ${shellEscape(apiKey)} --domain ${shellEscape(domain)}`;
|
|
163
|
+
if (!isWindowsNative()) {
|
|
164
|
+
output.info(`Discovery stops on its own after ${Math.round(DISCOVERY_TIMEOUT_SECONDS / 60)} minutes if it can't finish.`);
|
|
165
|
+
}
|
|
150
166
|
await runDiscoveryScript('install.sh', args);
|
|
151
167
|
}
|
|
152
168
|
|