mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-02 04:20:28 +08:00
Cygwin: pty: Keep code page between non-cygwin apps.
- After commit bb428520, there has been the disadvantage: 4) Code page cannot be changed by chcp.com. Acctually, chcp works itself and changes code page of its own pseudo console. However, since pseudo console is recreated for another process, it cannot inherit the code page. This patch clears this disadvantage.
This commit is contained in:
parent
0ed1104b9a
commit
9f783a84f5
@ -3094,6 +3094,11 @@ fhandler_pty_slave::setup_pseudoconsole (bool nopcon)
|
||||
HPCON_INTERNAL *hp = (HPCON_INTERNAL *) get_ttyp ()->h_pseudo_console;
|
||||
get_ttyp ()->h_pcon_write_pipe = hp->hWritePipe;
|
||||
}
|
||||
|
||||
if (get_ttyp ()->previous_code_page)
|
||||
SetConsoleCP (get_ttyp ()->previous_code_page);
|
||||
if (get_ttyp ()->previous_output_code_page)
|
||||
SetConsoleOutputCP (get_ttyp ()->previous_output_code_page);
|
||||
return true;
|
||||
|
||||
cleanup_pcon_in:
|
||||
@ -3133,6 +3138,8 @@ fhandler_pty_slave::close_pseudoconsole (tty *ttyp)
|
||||
if (ttyp->h_pseudo_console)
|
||||
{
|
||||
ttyp->wait_pcon_fwd ();
|
||||
ttyp->previous_code_page = GetConsoleCP ();
|
||||
ttyp->previous_output_code_page = GetConsoleOutputCP ();
|
||||
FreeConsole ();
|
||||
AttachConsole (ATTACH_PARENT_PROCESS);
|
||||
HPCON_INTERNAL *hp = (HPCON_INTERNAL *) ttyp->h_pseudo_console;
|
||||
|
@ -246,6 +246,8 @@ tty::init ()
|
||||
has_csi6n = false;
|
||||
need_invisible_console = false;
|
||||
invisible_console_pid = 0;
|
||||
previous_code_page = 0;
|
||||
previous_output_code_page = 0;
|
||||
}
|
||||
|
||||
HANDLE
|
||||
|
@ -107,6 +107,8 @@ private:
|
||||
bool has_csi6n;
|
||||
bool need_invisible_console;
|
||||
pid_t invisible_console_pid;
|
||||
UINT previous_code_page;
|
||||
UINT previous_output_code_page;
|
||||
|
||||
public:
|
||||
HANDLE from_master () const { return _from_master; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user