* win32-nat.c (child_create_inferior): Honor 'tty' command.
This commit is contained in:
parent
de17c821b3
commit
2becadeece
3 changed files with 72 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2002-09-13 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* win32-nat.c (child_create_inferior): Honor 'tty' command.
|
||||||
|
|
||||||
2002-09-13 Daniel Jacobowitz <drow@mvista.com>
|
2002-09-13 Daniel Jacobowitz <drow@mvista.com>
|
||||||
|
|
||||||
* gdbtypes.c (check_stub_method): Make static.
|
* gdbtypes.c (check_stub_method): Make static.
|
||||||
|
|
|
@ -1461,6 +1461,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
char *toexec;
|
char *toexec;
|
||||||
char shell[MAX_PATH + 1]; /* Path to shell */
|
char shell[MAX_PATH + 1]; /* Path to shell */
|
||||||
const char *sh;
|
const char *sh;
|
||||||
|
int tty;
|
||||||
|
int ostdin, ostdout, ostderr;
|
||||||
|
|
||||||
if (!exec_file)
|
if (!exec_file)
|
||||||
error ("No executable specified, use `target exec'.\n");
|
error ("No executable specified, use `target exec'.\n");
|
||||||
|
@ -1573,6 +1575,27 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
*temp = 0;
|
*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,
|
ret = CreateProcess (0,
|
||||||
args, /* command line */
|
args, /* command line */
|
||||||
NULL, /* Security */
|
NULL, /* Security */
|
||||||
|
@ -1583,6 +1606,17 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
NULL, /* current directory */
|
NULL, /* current directory */
|
||||||
&si,
|
&si,
|
||||||
&pi);
|
&pi);
|
||||||
|
if (tty >= 0)
|
||||||
|
{
|
||||||
|
close (tty);
|
||||||
|
dup2 (ostdin, 0);
|
||||||
|
dup2 (ostdout, 1);
|
||||||
|
dup2 (ostderr, 2);
|
||||||
|
close (ostdin);
|
||||||
|
close (ostdout);
|
||||||
|
close (ostderr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
||||||
|
|
||||||
|
|
|
@ -1461,6 +1461,8 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
char *toexec;
|
char *toexec;
|
||||||
char shell[MAX_PATH + 1]; /* Path to shell */
|
char shell[MAX_PATH + 1]; /* Path to shell */
|
||||||
const char *sh;
|
const char *sh;
|
||||||
|
int tty;
|
||||||
|
int ostdin, ostdout, ostderr;
|
||||||
|
|
||||||
if (!exec_file)
|
if (!exec_file)
|
||||||
error ("No executable specified, use `target exec'.\n");
|
error ("No executable specified, use `target exec'.\n");
|
||||||
|
@ -1573,6 +1575,27 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
*temp = 0;
|
*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,
|
ret = CreateProcess (0,
|
||||||
args, /* command line */
|
args, /* command line */
|
||||||
NULL, /* Security */
|
NULL, /* Security */
|
||||||
|
@ -1583,6 +1606,17 @@ child_create_inferior (char *exec_file, char *allargs, char **env)
|
||||||
NULL, /* current directory */
|
NULL, /* current directory */
|
||||||
&si,
|
&si,
|
||||||
&pi);
|
&pi);
|
||||||
|
if (tty >= 0)
|
||||||
|
{
|
||||||
|
close (tty);
|
||||||
|
dup2 (ostdin, 0);
|
||||||
|
dup2 (ostdout, 1);
|
||||||
|
dup2 (ostderr, 2);
|
||||||
|
close (ostdin);
|
||||||
|
close (ostdout);
|
||||||
|
close (ostderr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
error ("Error creating process %s, (error %d)\n", exec_file, GetLastError ());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue