-
Notifications
You must be signed in to change notification settings - Fork 53
Add nonunix platform support #274
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
Changes from all commits
91a78db
be46a35
c7ca1f0
1389cf3
1c6ef7a
652934f
db4f9a3
e96d5d7
38312ad
0012411
b883fe1
1d81d47
ba68520
39d3690
fbe5a14
d8f8ca3
1b0f605
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| CI_DESC="CI job using old Cap'n Proto and cmake versions" | ||
| CI_DIR=build-olddeps | ||
| export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-error=array-bounds" | ||
| NIX_ARGS=(--argstr capnprotoVersion "0.7.1" --argstr cmakeVersion "3.12.4") | ||
| NIX_ARGS=(--argstr capnprotoVersion "0.9.2" --argstr cmakeVersion "3.12.4") | ||
| BUILD_ARGS=(-k) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,7 @@ | |
| #include <init.capnp.h> | ||
| #include <init.capnp.proxy.h> // NOLINT(misc-include-cleaner) // IWYU pragma: keep | ||
|
|
||
| #include <charconv> | ||
| #include <cstring> | ||
| #include <cstring> // IWYU pragma: keep | ||
| #include <fstream> | ||
| #include <functional> | ||
| #include <iostream> | ||
|
|
@@ -16,9 +15,9 @@ | |
| #include <kj/memory.h> | ||
| #include <memory> | ||
| #include <mp/proxy-io.h> | ||
| #include <mp/util.h> | ||
| #include <stdexcept> | ||
| #include <string> | ||
| #include <system_error> | ||
| #include <utility> | ||
|
|
||
| class CalculatorImpl : public Calculator | ||
|
|
@@ -51,14 +50,10 @@ int main(int argc, char** argv) | |
| std::cout << "Usage: mpcalculator <fd>\n"; | ||
| return 1; | ||
| } | ||
| int fd; | ||
| if (std::from_chars(argv[1], argv[1] + strlen(argv[1]), fd).ec != std::errc{}) { | ||
| std::cerr << argv[1] << " is not a number or is larger than an int\n"; | ||
| return 1; | ||
| } | ||
| mp::SocketId socket{mp::StartSpawned(argv[1])}; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In c7a939b "util, refactor: Add SpawnConnectInfo type alias and use it" Didn't we lose our error handling here?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re: #274 (comment)
Yes previous error handling provided more context. Changed to catch and throw a more descriptive exception. It can be up to callers whether to crash in this case (which probably indicates a bug not a runtime error) and crashing in the examples seems ok |
||
| mp::EventLoop loop("mpcalculator", LogPrint); | ||
| std::unique_ptr<Init> init = std::make_unique<InitImpl>(); | ||
| mp::ServeStream<InitInterface>(loop, fd, *init); | ||
| mp::ServeStream<InitInterface>(loop, mp::MakeStream(loop, socket), *init); | ||
| loop.loop(); | ||
| return 0; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.