Skip to content

Commit 91fe708

Browse files
authored
Fix empty STDIN handling in user import-csv (#619)
1 parent d2ed260 commit 91fe708

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

features/user-import-csv.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ Feature: Import users from CSV
140140
| Bob Jones | contributor |
141141
| Bill Jones | administrator,author |
142142

143-
@broken
144143
Scenario: Importing users from STDIN
145144
Given a WP install
146145
And a users.csv file:

src/User_Command.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,6 +1150,10 @@ public function import_csv( $args, $assoc_args ) {
11501150

11511151
$csv_data[] = $data;
11521152
}
1153+
1154+
if ( empty( $indexes ) && empty( $csv_data ) ) {
1155+
WP_CLI::error( 'Unable to read content from STDIN.' );
1156+
}
11531157
} else {
11541158
$csv_data = new CsvIterator( $filename );
11551159
}

0 commit comments

Comments
 (0)