> On July 13, 2015, 5:20 p.m., Paul Brett wrote: > >
<a drive by comment suggested by Joris> is inline really necessary here? > On July 13, 2015, 5:20 p.m., Paul Brett wrote: > > 3rdparty/libprocess/include/process/subprocess.hpp, line 307 > > <https://reviews.apache.org/r/36424/diff/1/?file=1008891#file1008891line307> > > > > How about returning a tuple/struct of stdout, stderr and return code > > and let the caller decide what they want? > > Marco Massenzio wrote: > sure, that would be a possibility too, but it seems to me that the > "approved way" in Mesos is to return a `Try` for when something *may* go > wrong. > This is consistent across the entire code base. Maybe I am missing something, I did a grep for `Future<Try..` and could not find any occurence of it in the code base. Perhaps the reason is that it's customary to use Future's `Failure()` to indicate an error (as opposed to returning a `Try`). If anything `Result` would probably be more appropriate here than Try, but I'd like to hear what a shepherd has to say. The function could just return `Future<std::string>` and you could use `Failure()` to indicate the error. In that case you'll need to change the return type of `.then` lamda to `Future<std::string>` and also to replace a `return Error(...` on line 346 with `return Failure(...` (which you might want to do anyway for the sake of consistency). - Artem ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/36424/#review91566 ----------------------------------------------------------- On July 13, 2015, 9:21 p.m., Marco Massenzio wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/36424/ > ----------------------------------------------------------- > > (Updated July 13, 2015, 9:21 p.m.) > > > Review request for mesos, Benjamin Hindman and Cody Maloney. > > > Bugs: MESOS-3035 > https://issues.apache.org/jira/browse/MESOS-3035 > > > Repository: mesos > > > Description > ------- > > Jira: MESOS-2902 > > While researching how to execute an arbitrary script > to detect the Master IP address, it emerged clearly that > a helper method to execute an arbitrary command/script on > a node and obtain either stdout or stderr would have been > useful and avoided a lot of code repetition. > > This could not be ultimately used for the purpose at hand, > but I believe it to be useful enough (particularly, to avoid > people doing "coding by copy&paste" and/or waste time > researching the same functionality). > > This would also be beneficial in MESOS-2830, factoring out the remote command > execution logic. > > > Diffs > ----- > > 3rdparty/libprocess/include/process/subprocess.hpp > 310cb4f8e4e2faa5545dffd196d7490c868bc5d6 > 3rdparty/libprocess/src/tests/subprocess_tests.cpp > f6acb204582a9e696c3b09d4e4c543bb052e97d4 > > Diff: https://reviews.apache.org/r/36424/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Marco Massenzio > >
