Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1515475 - virsh console emits an empty line to stdout on failure
Summary: virsh console emits an empty line to stdout on failure
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2017-11-20 21:08 UTC by Brian J. Murrell
Modified: 2017-11-21 08:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2017-11-21 08:28:07 UTC

Attachments (Terms of Use)

Description Brian J. Murrell 2017-11-20 21:08:06 UTC
Description of problem:
If I use "virsh console foobar" to connect to a non-running domain, stdout gets a newline in addition to the stderr messaging.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. virsh console domain_that_is_not_running 2>/dev/null | hexdump -C 

Actual results:
00000000  0a                                                |.|

Expected results:
Nothing.  There should be no stdout at all when a domain connection failure occurs.  All messaging/output should be on stderr -- where most of it is, but for that lone 0x0a on stdout.

Additional info:

Comment 1 Peter Krempa 2017-11-21 08:28:07 UTC
you need to switch virsh to the quiet mode to avoid outputting anything to make the output user friendly

correct command line is:

virsh -q onsole domain_that_is_not_running 2>/dev/null | hexdump -C 

which correctly prints nothing.

It also avoids messages like
"Connected to domain DOMNAME"
"Escape character is "

in case when the console was connected.

Note You need to log in before you can comment on or make changes to this bug.