Created
May 1, 2014 06:51
-
-
Save rjsalts/46399174448f4a4eb9c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
$fdspec = array( | |
0 => array( "pipe", "r" ), | |
1 => array( "pipe", "w" ), | |
2 => array( "pipe", "w" ), | |
); | |
$proc = proc_open("ls",$fdspec,$pipes,NULL,array()); | |
if (is_resource($proc)) { | |
fclose($pipes[0]); | |
while(!feof($pipes[1])) { | |
static $line; | |
$prev_line = $line; | |
$line = stream_get_line($pipes[1],4096,"\n"); | |
} | |
print $prev_line; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment