File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545 run : bun install --frozen-lockfile
4646
4747 - name : Run unit tests
48- run : bun test tests/config.test.ts tests/output.test.ts tests/client.test.ts tests/errors.test.ts
48+ run : bun test
4949
5050 - name : Run integration tests
5151 run : bun test --timeout 60000 tests/integration/
Original file line number Diff line number Diff line change @@ -27,6 +27,21 @@ import {
2727 unknownOptionError ,
2828} from './errors.js' ;
2929import { VERSION } from './version.js' ;
30+ import * as fs from 'node:fs' ;
31+
32+ /**
33+ * Check if stdin has data available (for detecting piped input in non-TTY environments)
34+ * Uses fstatSync to check if stdin is a FIFO/pipe with data
35+ */
36+ function hasStdinData ( ) : boolean {
37+ try {
38+ const stats = fs . fstatSync ( 0 ) ; // fd 0 is stdin
39+ // Check if it's a FIFO (pipe) or regular file with size
40+ return stats . isFIFO ( ) || ( stats . isFile ( ) && stats . size > 0 ) ;
41+ } catch {
42+ return false ;
43+ }
44+ }
3045
3146interface ParsedArgs {
3247 command : 'list' | 'grep' | 'info' | 'call' | 'help' | 'version' ;
@@ -104,7 +119,7 @@ function parseArgs(args: string[]): ParsedArgs {
104119 if ( positional . length > 1 ) {
105120 result . command = 'call' ;
106121 result . args = positional . slice ( 1 ) . join ( ' ' ) ;
107- } else if ( ! process . stdin . isTTY ) {
122+ } else if ( ! process . stdin . isTTY && hasStdinData ( ) ) {
108123 // If stdin has data (piped input), treat as call command
109124 result . command = 'call' ;
110125 } else {
You can’t perform that action at this time.
0 commit comments