-
Notifications
You must be signed in to change notification settings - Fork 68
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
Export reproc's status code constants in C++ binding #74
Comments
I don't understand. We simply store whatever error that was returned by the OS in the error code. All major standard library implementations define a mapping that allows comparing against these system specific errors using the generic constants from https://en.cppreference.com/w/cpp/error/errc. If this doesn't work, please post a code example that reproduces the issue and I'll look into it |
From the page you've linked:
On Windows ( spdlog::info(std::errc::timed_out == std::error_code { 138, std::system_category() }); // false
spdlog::info(std::errc::timed_out == std::error_code {-REPROC_ETIMEDOUT, std::system_category() }); // false
spdlog::info(std::errc::timed_out == std::error_code { WAIT_TIMEOUT, std::system_category() }); // false
spdlog::info(std::errc::timed_out == std::error_code { 138, std::generic_category() }); // true
spdlog::info(std::errc::timed_out == std::error_code {-REPROC_ETIMEDOUT, std::generic_category() }); // false
spdlog::info(std::errc::timed_out == std::error_code { WAIT_TIMEOUT, std::generic_category() }); // false
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code { 138, std::system_category() }); // false
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code {-REPROC_ETIMEDOUT, std::system_category() }); // false
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code { WAIT_TIMEOUT, std::system_category() }); // false
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code { 138, std::generic_category() }); // true
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code {-REPROC_ETIMEDOUT, std::generic_category() }); // false
spdlog::info(std::make_error_condition(std::errc::timed_out) == std::error_code { WAIT_TIMEOUT, std::generic_category() }); // false |
I could have sworn MSVC's stdlib defined a mapping to allow comparing the system errors against the portable constants as well. I'll dig into the stdlib implementation when I find some time since it's been a while since I last looked at this. |
I opened microsoft/STL#2572 against the STL. Let's see what they have to say. |
I used |
There's likely more indeed, but I'm starting with this one to see if they're receptive to modifying the mapping at all since technically changing this in the stdlib is a compat break so they might not want to change it. If that's the case we'll need to figure out something in reproc itself. |
It seems they're interested in fixing this in stdlib but they don't do it in every release. If you encounter any more of these missing matches, I'd report them in that STL issue I linked so they can add extra matches for those as well. |
std::error_code
(to whichreproc++
maps in its methods) produces C++-defined error codes only for POSIX, making it impossible to check against them without using#if OS
codeThe text was updated successfully, but these errors were encountered: