AKCLIP_SET_CMD failure silently falls through to default path #40

Closed
opened 2026-06-26 04:52:04 +00:00 by akinus · 0 comments
Owner

In src/main.rs (around line 110), when AKCLIP_SET_CMD is set:

match std::process::Command::new(&cmd).arg(&full_command).output() {
    Ok(output) => {
        if output.status.success() {
            println!("Clipboard set successfully");
            exit(0);
        }
    }
    Err(_) => {}
}

If the custom command runs but exits non-zero, this block silently falls through to the default clipboard setting path. So the user sees no error, but their custom command failed. The error case should be reported (eprintln! + exit 1) instead of silently ignored.

Expected: when AKCLIP_SET_CMD exits non-zero, print an error to stderr and exit with status 1.

Reproduction:

AKCLIP_SET_CMD="/bin/false" akclip echo hi
# Currently: silently runs the default clipboard path
# Expected: prints error and exits 1
In src/main.rs (around line 110), when AKCLIP_SET_CMD is set: ```rust match std::process::Command::new(&cmd).arg(&full_command).output() { Ok(output) => { if output.status.success() { println!("Clipboard set successfully"); exit(0); } } Err(_) => {} } ``` If the custom command runs but exits non-zero, this block silently falls through to the default clipboard setting path. So the user sees no error, but their custom command failed. The error case should be reported (eprintln! + exit 1) instead of silently ignored. Expected: when AKCLIP_SET_CMD exits non-zero, print an error to stderr and exit with status 1. Reproduction: ```sh AKCLIP_SET_CMD="/bin/false" akclip echo hi # Currently: silently runs the default clipboard path # Expected: prints error and exits 1 ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
akinus/akclip#40
No description provided.