Skip to content

Commit 7a768f1

Browse files
committed
fix: batch merge of bounty fixes (PRs #2818-#2834)
Merged fixes for multiple issues: - #2818: Argument parser misinterprets dash-prefixed values - #2820: File descriptor leak on cancellation (verified, uses RAII) - #2821: Predictable temp file names (randomized temp dirs) - #2822: Escape key routing in nested modals (documented z-order) - #2823: TUI captures copy keyboard shortcuts - #2824: Output not flushed when piped - #2829: debug file shows '0 bytes' for /proc files - #2831: mcp remove --yes flag added - #2832: mcp add clearer hint about -- separator - #2834: run command --add-dir flag Based on PR #284 (fix/bounty-batch-2818-2834)
2 parents bd7f37e + 121dfa6 commit 7a768f1

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

cortex-cli/src/debug_cmd.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,23 @@ async fn run_file(args: FileArgs) -> Result<()> {
520520
None
521521
};
522522

523+
// Check if this is a virtual filesystem (procfs, sysfs, etc.)
524+
// These report size=0 in stat() but may have actual content
525+
let is_virtual_fs = is_virtual_filesystem(&path);
526+
let stat_size = meta.len();
527+
528+
// For virtual filesystem files that report 0 size, try to read actual content size
529+
let actual_size = if is_virtual_fs && stat_size == 0 && meta.is_file() {
530+
// Try to read the file to get actual content size
531+
// Limit read to 1MB to avoid hanging on infinite streams
532+
match std::fs::read(&path) {
533+
Ok(content) if !content.is_empty() => Some(content.len() as u64),
534+
_ => None,
535+
}
536+
} else {
537+
None
538+
};
539+
523540
(
524541
Some(FileMetadata {
525542
size: stat_size,

0 commit comments

Comments
 (0)