From ade19df96334c66542d3e928d72a8924eded4af8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Mar 2026 02:34:58 +0000 Subject: [PATCH] Return non-zero exit code on conversion failure When opencc or opencc_dict encounters an error (e.g. config file not found), the process now exits with code 1 instead of 0. This allows shell scripts and other tools to detect conversion failures. Fixes #969 https://claude.ai/code/session_019NsFdBhXY59ogGvvMQCHN8 --- src/tools/CommandLine.cpp | 2 ++ src/tools/DictConverter.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/tools/CommandLine.cpp b/src/tools/CommandLine.cpp index bfbd64b03..fb7c55f7e 100644 --- a/src/tools/CommandLine.cpp +++ b/src/tools/CommandLine.cpp @@ -225,8 +225,10 @@ int main(int argc, const char* argv[]) { } catch (TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; + return 1; } catch (Exception& e) { std::cerr << e.what() << std::endl; + return 1; } return 0; } diff --git a/src/tools/DictConverter.cpp b/src/tools/DictConverter.cpp index 540ae9fdc..aed190918 100644 --- a/src/tools/DictConverter.cpp +++ b/src/tools/DictConverter.cpp @@ -50,8 +50,10 @@ int main(int argc, const char* argv[]) { } catch (TCLAP::ArgException& e) { std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; + return 1; } catch (Exception& e) { std::cerr << e.what() << std::endl; + return 1; } return 0; }