gui\OsDetector::isWindows PHP Метод

isWindows() публичный статический Метод

This method is used to check if the current OS is Windows
public static isWindows ( ) : boolean
Результат boolean
    public static function isWindows()
    {
        return '\\' === DIRECTORY_SEPARATOR;
    }

Usage Example

Пример #1
0
 /**
  * Read the stdout pipe from Lazarus process. This function uses
  * stream_select to be non blocking
  *
  * @return void
  */
 public function tick()
 {
     $stream = $this->application->process->stdout->stream;
     $read = [$stream];
     $write = [];
     $except = [];
     $result = stream_select($read, $write, $except, 0);
     if ($result === false) {
         throw new Exception('stream_select failed');
     }
     if ($result === 0) {
         return;
     }
     // This solves a bug on Windows - If you read the exact size (> 1),
     // PHP will block
     if (OsDetector::isWindows()) {
         $status = fstat($stream);
         if ($status['size'] > 0) {
             $size = $status['size'];
             if ($size > 1) {
                 $size -= 1;
                 $data = stream_get_contents($stream, $size);
                 $data .= stream_get_contents($stream, 1);
             } else {
                 $data = stream_get_contents($stream, 1);
             }
             $this->application->process->stdout->emit('data', array($data, $this));
         }
     } else {
         // On Linux and OSX, we don't need to pass a size limit
         $data = stream_get_contents($stream);
         if (!empty($data)) {
             $this->application->process->stdout->emit('data', array($data, $this));
         }
     }
 }
All Usage Examples Of gui\OsDetector::isWindows