Skip to content

Commit 8def5ef

Browse files
gh-102628: Fix sqlite3 CLI prompt for Windows console users (#103898)
The prompt will still be incorrect in IDLE on Windows, as IDLE uses CTRL-D for EOF on all platforms.
1 parent 44b5c21 commit 8def5ef

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Lib/sqlite3/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ def main():
9494
db_name = repr(args.filename)
9595

9696
# Prepare REPL banner and prompts.
97+
eofkey = "CTRL-Z" if sys.platform == "win32" else "CTRL-D"
9798
banner = dedent(f"""
9899
sqlite3 shell, running on SQLite version {sqlite3.sqlite_version}
99100
Connected to {db_name}
100101
101102
Each command will be run using execute() on the cursor.
102-
Type ".help" for more information; type ".quit" or CTRL-D to quit.
103+
Type ".help" for more information; type ".quit" or {eofkey} to quit.
103104
""").strip()
104105
sys.ps1 = "sqlite> "
105106
sys.ps2 = " ... "
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Substitute CTRL-D with CTRL-Z in :mod:`sqlite3` CLI banner when running on
2+
Windows.

0 commit comments

Comments
 (0)