Skip to content

Commit

Permalink
desktop: Handle versions of lsb_release that wrap -s output in quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Aug 23, 2015
1 parent 612d0b2 commit e43a4a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/desktop/version.cpp
Expand Up @@ -152,8 +152,14 @@ std::string os_version()
static const std::string cmdline = lsb_release_bin + " -s -d";

scoped_posix_pipe p(popen(cmdline.c_str(), "r"));
const std::string& ver = read_pipe_line(p);
std::string ver = read_pipe_line(p);

if(ver.length() >= 2 && ver[0] == '"' && ver[ver.length() - 1] == '"') {
ver.erase(ver.length() - 1, 1);
ver.erase(0, 1);
}

// Check this again in case we got "" above for some weird reason.
if(!ver.empty()) {
return ver;
}
Expand Down

0 comments on commit e43a4a3

Please sign in to comment.