Skip to content

swaks should have a non-interactive mode that prevents any prompts #110

@martinvonwittich

Description

@martinvonwittich

swaks will automatically prompt for some information when it is missing from the command line, e.g.:

server ~ # swaks
To: 

This is fine for interactive usage, but counterproductive when swaks is used in non-interactive situations, e.g. when called from a Bats test suite. I'm currently writing such a test suite, and whenever I accidentally call swaks with invalid arguments (in this case an empty --to argument because the subshell expression that was supposed to generate the address failed), it causes the whole test suite to hang, without any clear indication what's actually wrong:

server ~/smtp-tests (master) # ./some-test.bats -f 'some'
some-test.bats
   some test description                                            1/1
[bats hangs here because swaks is waiting for input...]

As Bats suppresses STDOUT on normal runs, the swaks prompt text isn't actually visible by default, which makes this confusing to debug.

It would therefore be useful if swaks would be able to detect the non-interactive usage (e.g. with IO::Interactive), and/or support an option like --non-interactive. When in non-interactive mode, it should exit with an error message on STDERR and an exit code > 0 when any necessary information is missing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew functionality slated to be implemented someday

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions