Added a Rust wrapper for parsing cli args using GLib#1286
Added a Rust wrapper for parsing cli args using GLib#1286stevenengler merged 1 commit intoshadow:devfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1286 +/- ##
==========================================
+ Coverage 55.54% 55.57% +0.02%
==========================================
Files 141 141
Lines 20624 20637 +13
Branches 5066 5070 +4
==========================================
+ Hits 11456 11468 +12
Misses 6044 6044
- Partials 3124 3125 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
729da7e to
e6b3203
Compare
| pub fn process_parseArgStr( | ||
| commandLine: *const ::std::os::raw::c_char, | ||
| argc: *mut ::std::os::raw::c_int, | ||
| argv: *mut *mut *mut ::std::os::raw::c_char, |
There was a problem hiding this comment.
Huh didn't know *mut *mut *mut would be a thing.
|
|
||
| bool rv = !!g_shell_parse_argv(commandLine, argc, argv, &gError); | ||
| if (!rv && gError != NULL && gError->message != NULL) { | ||
| *error = strdup(gError->message); |
There was a problem hiding this comment.
Are we guaranteed that error is non-null here?
There was a problem hiding this comment.
Good catch, I added a check for that.
| InterposeMethod process_getInterposeMethod(Process* proc); | ||
|
|
||
| // A wrapper around GLib's `g_shell_parse_argv()` that doesn't use GLib types. | ||
| bool process_parseArgStr(const char* commandLine, int* argc, char*** argv, char** error); |
There was a problem hiding this comment.
Add a comment on the expectations on the caller for freeing the returned pointers.
e6b3203 to
ac2e39c
Compare
ac2e39c to
667a2e9
Compare
We will call this from Rust when parsing our configuration YAML.