Skip to content

Commit 13b9cc4

Browse files
authored
fix: use \.\CON device namespace for Windows console in headless login (#297)
1 parent d49fb5e commit 13b9cc4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

workspace-server/src/cli/headless-login.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ interface CredentialsJson {
4040
token_type?: string;
4141
}
4242

43+
const TTY_PATH = os.platform() === 'win32' ? '\\\\.\\CON' : '/dev/tty';
44+
4345
/**
4446
* Opens a readable stream from /dev/tty (Unix) or CON (Windows).
4547
* This bypasses process stdin entirely so credentials can't be intercepted
4648
* by a parent process.
4749
*/
4850
function openTtyRead(): fs.ReadStream {
49-
const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty';
50-
return fs.createReadStream(ttyPath, { encoding: 'utf8' });
51+
return fs.createReadStream(TTY_PATH, { encoding: 'utf8' });
5152
}
5253

5354
/**
5455
* Opens a writable stream to /dev/tty (Unix) or CON (Windows).
5556
*/
5657
function openTtyWrite(): fs.WriteStream {
57-
const ttyPath = os.platform() === 'win32' ? 'CON' : '/dev/tty';
58-
return fs.createWriteStream(ttyPath);
58+
return fs.createWriteStream(TTY_PATH);
5959
}
6060

6161
/**

0 commit comments

Comments
 (0)