fix(whatsapp): write pairing code to file for immediate access (#745)
The pairing code was only emitted to stdout, which is buffered by the calling process and not visible until the auth command exits (~120s). By also writing to store/pairing-code.txt the moment the code is ready, callers can poll that file and display the code to the user within seconds instead of after the 60s expiry window. Update the add-whatsapp skill instructions to use the background + file-poll pattern instead of waiting on buffered stdout. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -306,6 +306,16 @@ async function handlePairingCode(
|
||||
process.exit(3);
|
||||
}
|
||||
|
||||
// Write to file immediately so callers can read it without waiting for stdout
|
||||
try {
|
||||
fs.writeFileSync(
|
||||
path.join(projectRoot, 'store', 'pairing-code.txt'),
|
||||
pairingCode,
|
||||
);
|
||||
} catch {
|
||||
/* non-fatal */
|
||||
}
|
||||
|
||||
// Emit pairing code immediately so the caller can display it to the user
|
||||
emitAuthStatus('pairing-code', 'pairing_code_ready', 'waiting', {
|
||||
PAIRING_CODE: pairingCode,
|
||||
|
||||
Reference in New Issue
Block a user