Skip to content

Commit

Permalink
Updated test to open the correct file
Browse files Browse the repository at this point in the history
  • Loading branch information
calcinai committed Jun 14, 2016
1 parent 413a5a5 commit ee92ef1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/MMap/StreamWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ class StreamWrapper {
*/
public function stream_open($path, $mode){

$test = @fopen($path, $mode);
if($test === false){
throw new \Exception(sprintf('Could not open [%s]', $path));
}
fclose($test);

//Yuck.
$subprocess_path = __DIR__ .'/../../subprocess/mmap-proxy.py';

$components = self::parseURI($path);
$offset = isset($components['options']['offset']) ? $components['options']['offset'] : 0;

//Test it can be opened in the correct mode before passing to child
$test = @fopen($components['file_name'], $mode);
if($test === false){
throw new \Exception(sprintf('Could not open [%s]', $components['file_name']));
}
fclose($test);

$subprocess_cmd = sprintf('python -u %s %s %d %d', $subprocess_path, $components['file_name'], $components['block_size'], $offset);

$descriptorspec = [
Expand Down

0 comments on commit ee92ef1

Please sign in to comment.