procfetch
procfetch copied to clipboard
Handle failures and exceptions
Currently, the program doesn't handle exceptions and it halts. I'm listing some failures here that I have experienced.
1. Username
string getuser()
{
return getenv("USER");
}
See discussion on https://github.com/TanmayPatil105/procfetch/pull/145!
2. Theme
string getTheme()
{
auto args = "gsettings get org.gnome.desktop.interface gtk-theme"s;
auto s = Command::exec(args)->getOutput();
return s.substr(1, s.find("\'", 1) - 1);
}
Some machines don't have it installed. For example, Docker containers.
3. Icons
string getIcons()
{
auto args = "gsettings get org.gnome.desktop.interface icon-theme"s;
auto s = Command::exec(args)->getOutput();
return s.substr(1, s.find("\'", 1) - 1);
}
Same as above