diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 7c561a11f3..27f2d09f5f 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -418,12 +418,6 @@ virshRunConsole(vshControl *ctl, sigemptyset(&sighandler.sa_mask); - /* Put STDIN into raw mode so that stuff typed does not echo to the screen - * (the TTY reads will result in it being echoed back already), and also - * ensure Ctrl-C, etc is blocked, and misc other bits */ - if (vshTTYMakeRaw(ctl, true) < 0) - goto resettty; - if (!(con = virConsoleNew())) goto resettty; @@ -447,6 +441,19 @@ virshRunConsole(vshControl *ctl, if (virDomainOpenConsole(dom, dev_name, con->st, flags) < 0) goto cleanup; + vshPrintExtra(ctl, _("Connected to domain '%1$s'\n"), virDomainGetName(dom)); + vshPrintExtra(ctl, _("Escape character is %1$s"), priv->escapeChar); + if (priv->escapeChar[0] == '^') + vshPrintExtra(ctl, " (Ctrl + %c)", priv->escapeChar[1]); + vshPrintExtra(ctl, "\n"); + fflush(stdout); + + /* Put STDIN into raw mode so that stuff typed does not echo to the screen + * (the TTY reads will result in it being echoed back already), and also + * ensure Ctrl-C, etc is blocked, and misc other bits */ + if (vshTTYMakeRaw(ctl, true) < 0) + goto cleanup; + virObjectRef(con); if ((con->stdinWatch = virEventAddHandle(STDIN_FILENO, VIR_EVENT_HANDLE_READABLE, diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 694958f990..3d9c48629a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3017,7 +3017,6 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom, unsigned int flags) { int state; - virshControl *priv = ctl->privData; if ((state = virshDomainState(ctl, dom, NULL)) < 0) { vshError(ctl, "%s", _("Unable to get domain status")); @@ -3034,12 +3033,6 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom, return false; } - vshPrintExtra(ctl, _("Connected to domain '%1$s'\n"), virDomainGetName(dom)); - vshPrintExtra(ctl, _("Escape character is %1$s"), priv->escapeChar); - if (priv->escapeChar[0] == '^') - vshPrintExtra(ctl, " (Ctrl + %c)", priv->escapeChar[1]); - vshPrintExtra(ctl, "\n"); - fflush(stdout); if (virshRunConsole(ctl, dom, name, resume_domain, flags) == 0) return true;