We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f375042 commit baf4eb2Copy full SHA for baf4eb2
php/utils.php
@@ -1845,3 +1845,19 @@ function get_cache_dir() {
1845
$home = get_home_dir();
1846
return getenv( 'WP_CLI_CACHE_DIR' ) ? : "$home/.wp-cli/cache";
1847
}
1848
+
1849
+/**
1850
+ * Check whether any input is passed to STDIN.
1851
+ *
1852
+ * @return bool
1853
+ */
1854
+function has_stdin() {
1855
+ $handle = fopen( 'php://stdin', 'r' );
1856
+ $read = array( $handle );
1857
+ $write = null;
1858
+ $except = null;
1859
+ $streams = stream_select( $read, $write, $except, 0 );
1860
+ fclose( $handle );
1861
1862
+ return 1 === $streams;
1863
+}
0 commit comments