Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Bug Fixes

- Expand `~` in configured log file paths before opening the log.
- Treat an empty `--execute` argument as a no-op instead of reading SQL from stdin.

### Internal

Expand Down
2 changes: 1 addition & 1 deletion litecli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ def cli(
litecli.logger.debug("Launch Params: \n\tdatabase: %r", database)

# --execute argument
if execute:
if execute is not None:
try:
if csv:
litecli.formatter.format_name = "csv"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ def test_execute_arg(executor):
assert expected in result.output


@dbtest
def test_empty_execute_arg_does_not_read_stdin(executor):
result = CliRunner().invoke(cli, args=CLI_ARGS + ["--execute", ""], input="SELECT 42 AS from_stdin;")

assert result.exit_code == 0, result.output
assert "from_stdin" not in result.output


@dbtest
def test_execute_arg_with_table(executor):
run(executor, "create table test (a text)")
Expand Down