File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -225,7 +225,8 @@ pub async fn query_changed_files_for_affected(
225225 let mut options = QueryChangedFilesOptions {
226226 default_branch : ci,
227227 local : !ci,
228- stdin : true ,
228+ // Only auto-read stdin for piped input, otherwise interactive terminals hang waiting for EOF.
229+ stdin : !stdin ( ) . is_terminal ( ) ,
229230 ..Default :: default ( )
230231 } ;
231232
Original file line number Diff line number Diff line change @@ -46,6 +46,29 @@ mod query_affected {
4646 ) ;
4747 }
4848
49+ #[ test]
50+ fn includes_project_via_stdin ( ) {
51+ let sandbox = create_query_sandbox ( ) ;
52+
53+ let assert = sandbox. run_bin ( |cmd| {
54+ cmd. arg ( "query" )
55+ . arg ( "affected" )
56+ . write_stdin ( "basic/file.txt" ) ;
57+ } ) ;
58+
59+ let mut affected: Affected = serde_json:: from_str ( assert. stdout ( ) . trim ( ) ) . unwrap ( ) ;
60+
61+ assert ! ( !affected. projects. contains_key( "advanced" ) ) ;
62+ assert_eq ! (
63+ affected. projects. remove( "basic" ) . unwrap( ) ,
64+ AffectedProjectState {
65+ files: FxHashSet :: from_iter( [ "basic/file.txt" . into( ) ] ) ,
66+ tasks: FxHashSet :: from_iter( [ Target :: parse( "basic:dev" ) . unwrap( ) ] ) ,
67+ ..Default :: default ( )
68+ }
69+ ) ;
70+ }
71+
4972 #[ test]
5073 fn includes_task_for_input ( ) {
5174 let sandbox = create_query_sandbox ( ) ;
You can’t perform that action at this time.
0 commit comments