[libvirt] [PATCH 2/2] Try stdin for input when no file is specified

Michael Williams spacex at mspacex.net
Tue Jun 14 06:12:59 UTC 2011


Changes made, will submit an updated patchset after finalizing the rest
of this patch.

On 6/13/11 11:06 PM, Eric Blake wrote:
> I'm debating whether this line belongs here, or whether it belongs
> better in virsh.c.  That is, I don't know whether this is a
> virsh-specific feature, or whether all of the libvirt library should
> behave like this.

This very well could be only be needed in virsh, it just seemed like
util/util.c was where it could have the least duplication of code.

> I'm not even sure if stdin being a tty is the right check.

isatty() produces the correct behavior in all cases but the first one
you mentioned, ie running "virsh define", which will not wait for input
with the patch as it is.

I see the ctl->imode parameter used in main() to determine the
interactivity of the session, though that is only accessible at the
cmdOPERATION level, not in virFileReadAll().  Maybe (yet) another read
wrapper local to virsh.c that would check the ctl->imode if no path is
offered, and make a decision from there.

Thoughts?

-- 
~Michael Williams




More information about the libvir-list mailing list