Skip to content

Allow using Poco::FileStream to wrap arbitrary file handles/descriptors as C++ streams #3444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

dgrunwald
Copy link

In our application we open files in Python code, pass the file handle/descriptor to C++ code, and then use FileStream to access the file from C++. It's also possible for Python to pass a duplicate of the stdin handle to C++, so we need to handle the ERROR_BROKEN_PIPE special case.

@obiltschnig obiltschnig self-assigned this Oct 25, 2021
@obiltschnig obiltschnig added this to the Release 1.12.0 milestone Oct 25, 2021
@aleks-f
Copy link
Member

aleks-f commented May 29, 2022

@dgrunwald please redirect this to devel branch

@dgrunwald dgrunwald changed the base branch from master to devel May 29, 2022 10:51
Now that FileStream can be used to wrap arbitrary file handles, it is possible that it ends up wrapping a pipe.
@dgrunwald dgrunwald force-pushed the filestream-handle branch from 9c4165b to 4c6af8e Compare May 29, 2022 10:55
matejk added a commit that referenced this pull request Jan 29, 2024
…rs as C++ streams (#3444).

* Allow opening a file descriptor/HANDLE as C++ stream.

* FileStream: treat read from closed pipe as EOF.

* chore(Filestream): conde style (naming)

Co-Authored-By: Alex Fabijanic <alex@pocoproject.org>
Co-Authored-By: Matej Kenda <matejken@gmail.com>
@matejk
Copy link
Contributor

matejk commented Jan 29, 2024

I rebased this PR on latest devel and created new PR (#4424).

matejk added a commit that referenced this pull request Jan 31, 2024
…rs as C++ streams (#3444).

* Allow opening a file descriptor/HANDLE as C++ stream.

* FileStream: treat read from closed pipe as EOF.

* chore(Filestream): conde style (naming)

Co-Authored-By: Alex Fabijanic <alex@pocoproject.org>
Co-Authored-By: Matej Kenda <matejken@gmail.com>
matejk added a commit that referenced this pull request Feb 1, 2024
…rs as C++ streams (#3444).

* Allow opening a file descriptor/HANDLE as C++ stream.

* FileStream: treat read from closed pipe as EOF.

* chore(Filestream): conde style (naming)

Co-Authored-By: Alex Fabijanic <alex@pocoproject.org>
Co-Authored-By: Matej Kenda <matejken@gmail.com>
@dgrunwald
Copy link
Author

Closing in favor of #4424.

@dgrunwald dgrunwald closed this Apr 5, 2024
matejk added a commit that referenced this pull request May 7, 2024
…rs as C++ streams (#3444).

* Allow opening a file descriptor/HANDLE as C++ stream.

* FileStream: treat read from closed pipe as EOF.

* chore(Filestream): conde style (naming)

Co-Authored-By: Alex Fabijanic <alex@pocoproject.org>
Co-Authored-By: Matej Kenda <matejken@gmail.com>
matejk added a commit that referenced this pull request May 8, 2024
…ile handles/descriptors as C++ streams (#4424)

* Allow using Poco::FileStream to wrap arbitrary file handles/descriptors as C++ streams (#3444).

* Allow opening a file descriptor/HANDLE as C++ stream.

* FileStream: treat read from closed pipe as EOF.

* chore(Filestream): conde style (naming)

Co-Authored-By: Alex Fabijanic <alex@pocoproject.org>
Co-Authored-By: Matej Kenda <matejken@gmail.com>

* enh(FileStream): make FileIOS::open a virtual function. (#3444)

* test(FileStream): unit test for FileStream::openHandle (#3444)

* Update CONTRIBUTORS.

* test(FileStream): Win32 unit test fix.

* build(CMake): Require policy minimum version 3.15.

---------

Co-authored-by: Daniel Grunwald <grunwald@axivion.com>
Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants