diff options
author | Christopher Faylor <me+cygwin@cgf.cx> | 2002-09-14 03:28:23 +0000 |
---|---|---|
committer | Christopher Faylor <me+cygwin@cgf.cx> | 2002-09-14 03:28:23 +0000 |
commit | 2becadeece8514d5027d1de743ee843cfd0a109e (patch) | |
tree | 85df3263344c05f2152f47fc1c9e11eefa34ca68 /gdb/windows-nat.c | |
parent | de17c821b37ffda295746b31cf47e19ca2303b78 (diff) | |
download | gdb-2becadeece8514d5027d1de743ee843cfd0a109e.zip gdb-2becadeece8514d5027d1de743ee843cfd0a109e.tar.gz gdb-2becadeece8514d5027d1de743ee843cfd0a109e.tar.bz2 |
* win32-nat.c (child_create_inferior): Honor 'tty' command.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index 781a841..e2a85e1 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1461,6 +1461,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env) char *toexec; char shell[MAX_PATH + 1]; /* Path to shell */ const char *sh; + int tty; + int ostdin, ostdout, ostderr; if (!exec_file) error ("No executable specified, use `target exec'.\n"); @@ -1573,6 +1575,27 @@ child_create_inferior (char *exec_file, char *allargs, char **env) *temp = 0; } + if (!inferior_io_terminal) + tty = ostdin = ostdout = ostderr = -1; + else + { + tty = open (inferior_io_terminal, O_RDWR | O_NOCTTY); + if (tty < 0) + { + print_sys_errmsg (inferior_io_terminal, errno); + ostdin = ostdout = ostderr = -1; + } + else + { + ostdin = dup (0); + ostdout = dup (1); + ostderr = dup (2); + dup2 (tty, 0); + dup2 (tty, 1); + dup2 (tty, 2); + } + } + ret = CreateProcess (0, args, /* command line */ NULL, /* Security */ @@ -1583,6 +1606,17 @@ child_create_inferior (char *exec_file, char *allargs, char **env) NULL, /* current directory */ &si, &pi); + if (tty >= 0) + { + close (tty); + dup2 (ostdin, 0); + dup2 (ostdout, 1); + dup2 (ostderr, 2); + close (ostdin); + close (ostdout); + close (ostderr); + } + if (!ret) error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ()); |