diff options
| author | Andrew Dunstan <andrew@dunslane.net> | 2013-01-24 16:01:31 -0500 |
|---|---|---|
| committer | Andrew Dunstan <andrew@dunslane.net> | 2013-01-24 16:01:31 -0500 |
| commit | 474cfc390a83964f9e2154ada5d28e6cc7c4a395 (patch) | |
| tree | c4c2b766bb416c20c91ad67cc3e92c8191b9dc2f /src/bin/psql/command.c | |
| parent | 3a25b2d70c28942cf2c5e4d90d3a643baf845dfc (diff) | |
Use correct output device for Windows prompts.
This ensures that mapping of non-ascii prompts
to the correct code page occurs.
Bug report and original patch from Alexander Law,
reviewed and reworked by Noah Misch.
Backpatch to all live branches.
Diffstat (limited to 'src/bin/psql/command.c')
| -rw-r--r-- | src/bin/psql/command.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 98548d36551..3cd4e0152d7 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -939,6 +939,17 @@ exec_command(const char *cmd, char *fname = psql_scan_slash_option(scan_state, OT_NORMAL, NULL, true); +#if defined(WIN32) && !defined(__CYGWIN__) + + /* + * XXX This does not work for all terminal environments or for output + * containing non-ASCII characters; see comments in simple_prompt(). + */ +#define DEVTTY "con" +#else +#define DEVTTY "/dev/tty" +#endif + expand_tilde(&fname); /* This scrolls off the screen when using /dev/tty */ success = saveHistory(fname ? fname : DEVTTY, -1, false, false); |
