{"record":{"id":"bd20294c2a4bbb48","repo":"pbakaus/impeccable","slug":"question-y-n","errorCode":null,"errorMessage":"{question} [Y/n] ","messagePattern":"\\{question\\} \\[Y/n\\] ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/detect/src/cli.rs","lineNumber":828,"sourceCode":"            if should_ignore_detection_file(&resolved, &cwd, &ctx.config) {\n                continue;\n            }\n            let opts = ctx.scan_options_for(Some(&resolved));\n            match ctx.detect_local_file(&resolved, &opts) {\n                Ok(f) => all.extend(f),\n                Err(e) => {\n                    let message = e.message.clone();\n                    ctx.report_local_scan_failure(target, &message);\n                }\n            }\n        }\n    }\n    Ok(())\n}\n\n/// JS `confirm(question)`: readline on a TTY stdin, prompt to stderr.\nfn confirm(io: &mut Io, question: &str) -> bool {\n    io.err(&format!(\"{question} [Y/n] \"));\n    let _ = io.stderr.flush();\n    let mut answer = String::new();\n    // Only reached when stdin is a TTY, so a direct line read is what the\n    // JS readline does too.\n    let _ = std::io::stdin().read_line(&mut answer);\n    let a = impeccable_core::js::trim(&answer);\n    a.is_empty() || a.eq_ignore_ascii_case(\"y\") || a.eq_ignore_ascii_case(\"yes\")\n}\n\nfn stderr_is_tty() -> bool {\n    #[cfg(unix)]\n    {\n        extern \"C\" {\n            fn isatty(fd: i32) -> i32;\n        }\n        unsafe { isatty(2) == 1 }\n    }\n    #[cfg(not(unix))]","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/pbakaus/impeccable/blob/2bc2879276c1f321a53c4ca99d3371e411329b52/crates/detect/src/cli.rs#L810-L846","documentation":"confirm() is scan_targets' interactive JS-style confirmation. Before reading a line from stdin it writes the prompt \"<question> [Y/n] \" to stderr and flushes it. This string is the prompt itself, not an error; it appears whenever a directory target with >50 files is scanned on a TTY, or in any other call site that needs explicit user consent before proceeding.","triggerScenarios":"`impeccable detect <dir>` where the directory has more than 50 scannable files, stdin is a TTY, and JSON/quiet modes are off — the prompt text is emitted to stderr and the process blocks waiting for one line of stdin.","commonSituations":"Interactive terminal scans of large directories; CI systems that allocate a PTY causing the tool to think it is interactive and hang waiting for input; automated wrappers that do not answer the prompt.","solutions":["Answer 'Y' and press Enter to proceed, or 'n' to abort","Redirect stdin from /dev/null or use non-TTY invocation in scripts so the prompt path is skipped","Use --json or --quiet flags to suppress interactive confirmation","Narrow the scan target below 50 files to avoid the prompt"],"exampleFix":"// before (hangs in CI with PTY)\n$ impeccable detect .\nContinue? [Y/n]\n\n// after (script-safe)\n$ impeccable detect . < /dev/null\n# or\n$ impeccable detect --json .","handlingStrategy":"fallback","validationCode":"if (process.stdin.isTTY && !flags.json && !flags.quiet) {\n  console.warn('detect may block on a Continue? [Y/n] prompt');\n}","typeGuard":null,"tryCatchPattern":"// Set a timeout when the process may be waiting on stdin\nconst child = spawn('impeccable', ['detect', dir]);\nconst t = setTimeout(() => child.kill(), 30000);\nchild.on('exit', () => clearTimeout(t));","preventionTips":["Redirect stdin from /dev/null in scripts so the prompt path is skipped","Use --json/--quiet to disable interactive confirmation","Keep directory targets small enough to avoid the >50-file prompt"],"tags":["cli","interactive","stdin"],"backgroundTag":"missing-required-flag","analyzedSha":"2bc2879276c1f321a53c4ca99d3371e411329b52","analyzedAt":"2026-09-08T04:51:14.109Z","contentChangedAt":"2026-09-08T04:51:14.109Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}