Skip to content

Commit

Permalink
fix: [cmd] remove bash use
Browse files Browse the repository at this point in the history
  remove bash use

Log: remove bash use
Task: https://pms.uniontech.com/task-view-362321.html
  • Loading branch information
starhcq committed Sep 10, 2024
1 parent 3e31964 commit 9ff7f27
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions libimageviewer/unionimage/baseutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,21 +475,8 @@ bool mountDeviceExist(const QString &path)
bool checkCommandExist(const QString &command)
{
try {
QProcess bash;
bash.start("bash");
bash.waitForStarted();
bash.write(("command -v " + command).toUtf8());
bash.closeWriteChannel();
if (!bash.waitForFinished()) {
qWarning() << bash.errorString();
return false;
}
auto output = bash.readAllStandardOutput();
if (output.isEmpty()) {
return false;
} else {
return true;
}
QString path = QStandardPaths::findExecutable(command);
return !path.isEmpty();
} catch (std::logic_error &e) {
qWarning() << e.what();
return false;
Expand Down

0 comments on commit 9ff7f27

Please sign in to comment.