diff options
author | saturneric <[email protected]> | 2023-02-04 05:24:01 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-02-04 05:24:01 +0000 |
commit | 04c6005931a1226e795ec32b1b31a9c23dc24fda (patch) | |
tree | f421907f46606cff116a127001165060c89e3b20 /src/core/function/gpg | |
parent | feat: add submodule spdlog (diff) | |
download | GpgFrontend-04c6005931a1226e795ec32b1b31a9c23dc24fda.tar.gz GpgFrontend-04c6005931a1226e795ec32b1b31a9c23dc24fda.zip |
fix: solve some issues
1. solve compile issues
2. improve log for cammand executor
Diffstat (limited to 'src/core/function/gpg')
-rw-r--r-- | src/core/function/gpg/GpgCommandExecutor.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 720388a0..8f652b96 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -79,17 +79,23 @@ void GpgFrontend::GpgCommandExecutor::Execute( QObject::connect( cmd_process, &QProcess::readyReadStandardOutput, [interact_func, cmd_process]() { interact_func(cmd_process); }); - QObject::connect(cmd_process, &QProcess::errorOccurred, [=]() { - SPDLOG_ERROR("error in executing command: {}", cmd); - }); - QObject::connect(cmd_process, - qOverload<int, QProcess::ExitStatus>(&QProcess::finished), - [=](int, QProcess::ExitStatus status) { - if (status == QProcess::NormalExit) - SPDLOG_INFO("succeed in executing command: {}", cmd); - else - SPDLOG_WARN("error in executing command: {}", cmd); - }); + QObject::connect( + cmd_process, &QProcess::errorOccurred, + [=](QProcess::ProcessError error) { + SPDLOG_ERROR("error in executing command: {} error: {} stdout: {}", + cmd, error, + cmd_process->readAllStandardOutput().toStdString()); + }); + QObject::connect( + cmd_process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished), + [=](int, QProcess::ExitStatus status) { + if (status == QProcess::NormalExit) + SPDLOG_INFO("succeed in executing command: {}, exit status: {}", + cmd, status); + else + SPDLOG_ERROR("error in executing command: {}, exit status: {}", cmd, + status); + }); cmd_process->setProgram(QString::fromStdString(cmd)); |