protected function writeStreamTask(Context $context, string $path, bool $append = false): \Generator
    {
        if (!yield $this->pool->submit($context, new MethodCall(static::class, 'checkFileWritableJob', $path, !$append && !$this->fileTransferSupported))) {
            throw new FilesystemException(\sprintf('File is not writable: "%s"', $path));
        }
        
        if (!$this->fileTransferSupported) {
            return new WritableFileStream($this->pool, $path);
        }
        
        $file = yield $this->pool->submit($context, new MethodCall(FileDescriptor::class, 'open', $path, $append ? 'ab' : 'wb'));
        
        return new WritableDescriptorStream($this->pool, $path, $file);
    }