-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Description:
I'm encountering an issue with the clickhouse-sql-parser tool where it's impossible to properly separate error output (stderr) from standard output (stdout). Currently, all messages (including error messages) are being directed to stdout, which prevents proper error handling and logging.
Expected behavior:
- Error messages should be printed to
stderr, index 2. - Regular (non‑error) output should go to
stdout, index 1. - This would allow users to:
- Suppress normal output while still seeing errors (e.g., using
1>/dev/null). - Redirect errors to log files separately from regular output.
- Implement proper error detection in scripts (e.g., checking exit codes and error streams).
- Suppress normal output while still seeing errors (e.g., using
Actual behavior:
All output (including error messages) is being sent to stdout, making it impossible to distinguish between normal operation and error conditions without parsing the output content.
Example:
When running:
clickhouse-sql-parser \
-f ${SCHEMA_FILE} \
-format 1>/dev/nullEven if an error occurs (e.g., file not found, syntax error), the error message is still sent to stdout and gets suppressed by the redirection (1>/dev/null), so the user doesn't see any indication that something went wrong.
Impact:
- Inability to implement proper error handling in automation scripts.
- Difficulty in monitoring and logging errors separately from normal output.
- Potential for silent failures in automated workflows.
Proposed solution:
Redirect error messages and warnings to stderr instead of stdout, following standard UNIX/Linux conventions for command‑line tools.
Environment:
- Tool:
clickhouse-sql-parser - OS: MacOS (arm64)
- Version: v0.3.8