procfetch
procfetch copied to clipboard
Leakage of command output
Description
Recently, I removed /home/linuxbrew/.linuxbrew/bin/ from PATH
Since, brew still exists as a binary and we check if Path::of("/home/linuxbrew/.linuxbrew/bin/brew"s).isExecutable() and execute brew list | { tr '' '\n'; }
Output
__ __ __ __
/ / / // /_ __ __ ____ / /_ __ __
/ / / // __ \ / / / // __ \ / __// / / /
/ /_/ // /_/ // /_/ // / / // /_ / /_/ /
\____//_.___/ \__,_//_/ /_/ \__/ \__,_/
tanmay@tanmay-lenovo
OS : Ubuntu 23.04 x86_64
Host : 81DE Lenovo ideapad 330-15IKB
Kernel : 6.2.0-34-generic
UpTime : 1 d, 14 hours, 37 mins
RAM : 3033MiB / 7840MiB
shell : zsh
DE : ubuntu:GNOME
Resolution : 1366x768
Theme : Yaru-viridian-dark
Icons : Yaru-viridian-dark
CPU : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
CPU Temperature : 36.5 °C
GPU : Intel Corporation UHD Graphics 620
GPU : NVIDIA Corporation GP108M [GeForce MX150]
+sh: 1: brew: not found
Packages : 3243 dpkg; 40 flatpak; 23 snap; 3 npm; 0 brew; 0 rpm;
🔋 62% [===============================>------------------]
To solve this, instead of specifying the binary name, we should provide it's path
if (Path::of("/home/linuxbrew/.linuxbrew/bin/brew"s).isExecutable())
{
Command::exec_async("/home/linuxbrew/.linuxbrew/bin/brew list | { tr '' '\n'; }"s, [&](auto c) {
std::lock_guard<std::mutex> lock(mtx);
pkgs.push_back(rec{"brew"s, c->getOutputLines()});
});
}
What say @youpong?
Edit: tbh I don't want brew to get displayed under packages if it's not in the PATH :p
I think the code you wrote above solves the problem.
In addition, I made a PR to add a new version of Command::exec_async that takes paths so that it is easier to use paths around.The PR includes a rewrite of the Homebrew code fragment with the new method.