Skip to content

Commit 1911686

Browse files
committed
Pass SOCKET_CLI_API_TOKEN to coana
1 parent 1cc88a7 commit 1911686

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/commands/scan/scan-reachability.mts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@ export async function scanReachability(cwd: string): Promise<CResult<unknown>> {
1111
const result = await spawn(
1212
constants.execPath,
1313
[
14+
// Lazily access constants.nodeNoWarningsFlags.
15+
...constants.nodeNoWarningsFlags,
1416
// Lazily access constants.coanaBinPath.
1517
constants.coanaBinPath,
1618
'run',
1719
cwd,
18-
'--disable-report-submission',
1920
'--output-dir',
2021
cwd,
22+
'--disable-report-submission',
2123
'--socket-mode',
22-
`./${DOT_SOCKET_DOT_FACTS_JSON}`,
24+
DOT_SOCKET_DOT_FACTS_JSON,
2325
],
24-
{ cwd },
26+
{
27+
cwd,
28+
env: {
29+
...process.env,
30+
// Lazily access constants.ENV.SOCKET_CLI_API_TOKEN
31+
SOCKET_CLI_API_TOKEN: constants.ENV.SOCKET_CLI_API_TOKEN
32+
}
33+
},
2534
)
2635
return { ok: true, data: result.stdout.trim() }
2736
} catch (e) {
28-
return { ok: false, data: e, message: (e as Error)?.message }
37+
const message = (e as any)?.stdout ?? (e as Error)?.message
38+
return { ok: false, data: e, message }
2939
}
3040
}

0 commit comments

Comments
 (0)