The derived Default implementation for R2PipeSpawnOptions created an empty args and an empty exepath. That is almost certainly not what was intended since the example that showed its use looked like this:
let opts = R2PipeSpawnOptions {
exepath: "radare2".to_owned(),
..Default::default()
};
implying that the Default implementation would provide a reasonable default and that you could just override the options that you wanted to override. However, if you tried to do something like the following:
let opts = R2PipeSpawnOptions {
args: vec!["-2"],
..Default::default()
};
to just disable the warnings spat out on stderr, R2Pipe would fail to spawn since the exepath was empty. This is the case since the spawn function would default initialize the exepath if you didn't provide anyR2PipeSpawnOptions by passing None, but simply took what you passed in if you passed Some(R2PipeSpawnOptions)
By providing a proper Default implementation, this allows the previous method of overriding the args for the options without having to also override the exepath. It also simplifies the handling when you do not provide any options.
The derived
Default
implementation forR2PipeSpawnOptions
created an emptyargs
and an emptyexepath
. That is almost certainly not what was intended since the example that showed its use looked like this:implying that the
Default
implementation would provide a reasonable default and that you could just override the options that you wanted to override. However, if you tried to do something like the following:to just disable the warnings spat out on stderr,
R2Pipe
would fail to spawn since theexepath
was empty. This is the case since thespawn
function would default initialize theexepath
if you didn't provide anyR2PipeSpawnOptions
by passingNone
, but simply took what you passed in if you passedSome(R2PipeSpawnOptions)
By providing a proper
Default
implementation, this allows the previous method of overriding theargs
for the options without having to also override theexepath
. It also simplifies the handling when you do not provide any options.Checklist
Description