Skip to content

Use exit code 1 if redis-cli fails to connect#10438

Merged
oranagra merged 2 commits intoredis:unstablefrom
tezc:fix-exit-code
Mar 21, 2022
Merged

Use exit code 1 if redis-cli fails to connect#10438
oranagra merged 2 commits intoredis:unstablefrom
tezc:fix-exit-code

Conversation

@tezc
Copy link
Collaborator

@tezc tezc commented Mar 17, 2022

Use exit code 1 if redis-cli fails to connect.

Before #10382, on a connection failure, exit code would be 1. After this PR, whether connection is established or not, noninteractive() return value is used as the exit code. On a failure, this function returns REDIS_ERR which is -1. It becomes 255 as exit codes are between 0-255.

There is nothing wrong by returning 1 or 255 on failure as far as I know but it'll break things that expect to see 1 as exit code on a connection failure. This is also how we realized the issue. With this PR, changing behavior back to using 1 as exit code to preserve backward compatibility.

Opened #10437, to discuss further improvement for exit codes.

@oranagra oranagra merged commit 4517fad into redis:unstable Mar 21, 2022
@tezc tezc deleted the fix-exit-code branch April 8, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants