mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
fix(cli): ignore stream-json input format in TTY mode to prevent hanging
- Force TEXT input format in TTY mode instead of allowing stream-json which would cause the process to hang when runNonInteractiveStreamJson is called without proper stdin data. - Always initialize app regardless of input format to ensure proper setup. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
f770be495f
commit
7679910f26
1 changed files with 5 additions and 6 deletions
|
|
@ -385,17 +385,16 @@ export async function main() {
|
|||
setMaxSizedBoxDebugging(isDebugMode);
|
||||
|
||||
// Check input format early to determine initialization flow
|
||||
const inputFormat =
|
||||
typeof config.getInputFormat === 'function'
|
||||
// In TTY mode, ignore stream-json input format to prevent process from hanging
|
||||
const inputFormat = process.stdin.isTTY
|
||||
? InputFormat.TEXT
|
||||
: typeof config.getInputFormat === 'function'
|
||||
? config.getInputFormat()
|
||||
: InputFormat.TEXT;
|
||||
|
||||
// For stream-json mode, defer config.initialize() until after the initialize control request
|
||||
// For other modes, initialize normally
|
||||
let initializationResult: InitializationResult | undefined;
|
||||
if (inputFormat !== InputFormat.STREAM_JSON) {
|
||||
initializationResult = await initializeApp(config, settings);
|
||||
}
|
||||
const initializationResult = await initializeApp(config, settings);
|
||||
|
||||
if (config.getExperimentalZedIntegration()) {
|
||||
return runAcpAgent(config, settings, argv);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue