mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 10:19:37 +00:00
fix(auth): handle Windows spawn for profile creation
This commit is contained in:
@@ -31,7 +31,8 @@ import {
|
|||||||
table,
|
table,
|
||||||
infoBox,
|
infoBox,
|
||||||
} from '../utils/ui';
|
} from '../utils/ui';
|
||||||
import { detectClaudeCli } from '../utils/claude-detector';
|
import { getClaudeCliInfo } from '../utils/claude-detector';
|
||||||
|
import { escapeShellArg } from '../utils/shell-executor';
|
||||||
import { InteractivePrompt } from '../utils/prompt';
|
import { InteractivePrompt } from '../utils/prompt';
|
||||||
import packageJson from '../../package.json';
|
import packageJson from '../../package.json';
|
||||||
import { hasUnifiedConfig } from '../config/unified-config-loader';
|
import { hasUnifiedConfig } from '../config/unified-config-loader';
|
||||||
@@ -208,8 +209,8 @@ class AuthCommands {
|
|||||||
console.log('');
|
console.log('');
|
||||||
|
|
||||||
// Detect Claude CLI
|
// Detect Claude CLI
|
||||||
const claudeCli = detectClaudeCli();
|
const claudeInfo = getClaudeCliInfo();
|
||||||
if (!claudeCli) {
|
if (!claudeInfo) {
|
||||||
console.log(fail('Claude CLI not found'));
|
console.log(fail('Claude CLI not found'));
|
||||||
console.log('');
|
console.log('');
|
||||||
console.log('Please install Claude CLI first:');
|
console.log('Please install Claude CLI first:');
|
||||||
@@ -217,11 +218,26 @@ class AuthCommands {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { path: claudeCli, needsShell } = claudeInfo;
|
||||||
|
|
||||||
// Execute Claude in isolated instance (will auto-prompt for login if no credentials)
|
// Execute Claude in isolated instance (will auto-prompt for login if no credentials)
|
||||||
const child: ChildProcess = spawn(claudeCli, [], {
|
// On Windows, .cmd/.bat/.ps1 files need shell: true to execute properly
|
||||||
stdio: 'inherit',
|
let child: ChildProcess;
|
||||||
env: { ...process.env, CLAUDE_CONFIG_DIR: instancePath },
|
if (needsShell) {
|
||||||
});
|
const cmdString = escapeShellArg(claudeCli);
|
||||||
|
child = spawn(cmdString, {
|
||||||
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
|
shell: true,
|
||||||
|
env: { ...process.env, CLAUDE_CONFIG_DIR: instancePath },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
child = spawn(claudeCli, [], {
|
||||||
|
stdio: 'inherit',
|
||||||
|
windowsHide: true,
|
||||||
|
env: { ...process.env, CLAUDE_CONFIG_DIR: instancePath },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
child.on('exit', (code: number | null) => {
|
child.on('exit', (code: number | null) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user