public function run($runnable, &$ran = null)
    {
        $ran = false;
        $fd = call_user_func($this->filesystem['fopen'], $this->file, 'w');

        if (!$fd) {
            throw new \RuntimeException("Could not open file {$this->file}");
        }

        $hasLock = call_user_func($this->filesystem['flock'], $fd, $this->flags);
        if (!$hasLock) {
            call_user_func($this->filesystem['fclose'], $fd);
            // lock failed
            return false;
        }
        $exception = false;
        $result = null;
        try {
            $result = call_user_func($runnable);
        } catch (\Exception $exception) {
        }

        call_user_func($this->filesystem['flock'], $fd, LOCK_UN);
        call_user_func($this->filesystem['fclose'], $fd);

        $ran = true;
        if ($exception !== false) {
            throw $exception;
        }
        return $result;
    }