[ 
https://issues.apache.org/jira/browse/MESOS-4416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jingang Li updated MESOS-4416:
------------------------------
    Description: 
When check the perf version with the "perf::version" gets the command output 
"perf --version". The command return string includes a "return key". It cause 
the version parse fails. If add the strings::trim, the issue is fixed.

The old code:
Future<Version> version()
{
  internal::Perf* perf = new internal::Perf({"--version"});
  Future<string> output = perf->output();
  spawn(perf, true);

  return output
    .then([](const string& output) -> Future<Version> {
      // Trim off the leading 'perf version ' text to convert.
      return Version::parse(strings::remove(
          output, "perf version ", strings::PREFIX));
    });
};

Change to below, issue is fixed:
Future<Version> version()
{
  internal::Perf* perf = new internal::Perf({"--version"});
  Future<string> output = perf->output();
  spawn(perf, true);

  return output
    .then([](const string& output) -> Future<Version> {
      // Trim off the leading 'perf version ' text to convert.
      return Version::parse(strings::trim(strings::remove(
          output, "perf version ", strings::PREFIX)));
    });
};


  was:
When check the perf version with the "perf::version" gets the command output 
"perf --version". The command return string includes a "return key". It cause 
the version parse fails. If add the strings::trim, the issue is fixed.

The old code:
Future<Version> version()
{
  internal::Perf* perf = new internal::Perf({"--version"});
  Future<string> output = perf->output();
  spawn(perf, true);

  return output
    .then([](const string& output) -> Future<Version> {
      // Trim off the leading 'perf version ' text to convert.
      return Version::parse(strings::remove(
          output, "perf version ", strings::PREFIX));
    });
};

Change to below, issue is fixed:



> Get the perf version function return fail
> -----------------------------------------
>
>                 Key: MESOS-4416
>                 URL: https://issues.apache.org/jira/browse/MESOS-4416
>             Project: Mesos
>          Issue Type: Bug
>          Components: c++ api
>    Affects Versions: 0.25.0
>         Environment: Suse SLE 12 SP1
>            Reporter: Jingang Li
>            Priority: Minor
>             Fix For: 0.26.0
>
>
> When check the perf version with the "perf::version" gets the command output 
> "perf --version". The command return string includes a "return key". It cause 
> the version parse fails. If add the strings::trim, the issue is fixed.
> The old code:
> Future<Version> version()
> {
>   internal::Perf* perf = new internal::Perf({"--version"});
>   Future<string> output = perf->output();
>   spawn(perf, true);
>   return output
>     .then([](const string& output) -> Future<Version> {
>       // Trim off the leading 'perf version ' text to convert.
>       return Version::parse(strings::remove(
>           output, "perf version ", strings::PREFIX));
>     });
> };
> Change to below, issue is fixed:
> Future<Version> version()
> {
>   internal::Perf* perf = new internal::Perf({"--version"});
>   Future<string> output = perf->output();
>   spawn(perf, true);
>   return output
>     .then([](const string& output) -> Future<Version> {
>       // Trim off the leading 'perf version ' text to convert.
>       return Version::parse(strings::trim(strings::remove(
>           output, "perf version ", strings::PREFIX)));
>     });
> };



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to