Skip to content

Commit 2e99537

Browse files
fix: Prevent overwriting error states on successful exit codes in CliInterface
- Updated the processFinished and extractProcessFinished methods to retain error states detected from stdout, even when the exit code is 0. - This change ensures that errors such as long file name issues are not masked by a successful exit code, improving error handling and user feedback. Enhances reliability in archive processing by maintaining accurate error reporting. bug: https://pms.uniontech.com/bug-view-338535.html
1 parent 133c855 commit 2e99537

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

3rdparty/interface/archiveinterface/cliinterface.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,10 @@ void CliInterface::processFinished(int exitCode, QProcess::ExitStatus exitStatus
13871387
m_isCorruptArchive = false;
13881388
}
13891389

1390-
if (exitCode == 0) { // job正常结束
1390+
// If we already detected an error from stdout parsing, do not overwrite it
1391+
// just because the cli tool exits with code 0 (e.g. unrar may return 0 even
1392+
// when some entries fail to extract, such as long file name cases).
1393+
if (exitCode == 0 && m_finishType != PFT_Error && m_finishType != PFT_Cancel) {
13911394
m_finishType = PFT_Nomral;
13921395
}
13931396

@@ -1403,7 +1406,8 @@ void CliInterface::extractProcessFinished(int exitCode, QProcess::ExitStatus exi
14031406

14041407
deleteProcess();
14051408

1406-
if (0 == exitCode) { // job正常结束
1409+
// Keep stdout-detected errors (e.g. long name) even if exitCode is 0.
1410+
if (0 == exitCode && m_finishType != PFT_Error && m_finishType != PFT_Cancel) {
14071411
m_finishType = PFT_Nomral;
14081412
}
14091413

0 commit comments

Comments
 (0)