[elrepo] nvidia-detect feature enhancement

Phil Perry phil at elrepo.org
Fri Feb 13 12:44:19 EST 2015


On 13/02/15 17:27, Phil Perry wrote:
> On 13/02/15 16:40, Pat Riehecky wrote:
>>
>> My memory says typically $() and `` don't capture STDERR.
>>
>> Quick tests seem to support that:
>>
>> yum install `echo thing >&2`
>> yum install $(echo thing >&2)
>>
>> (also, pull request sent for errors to STDERR, but you should probably
>> double check it)
>>
>> Pat
>>
> 
> Hi Pat,
> 
> Indeed, that seems to be the case (learn something new every day!)
> 
> At which point we could write all the verbose output to stderr and still
> have it written to the console by default, with only the package name
> written to stdout, and
> 
> # yum install $(nvidia-detect)
> 
> would only parse the package name as desired.
> 
> So at which point do we still need a terse option given that
> nvidia-detect 2> /dev/null would achieve the same result?
> 
> 

Answering my own question, I think having verbose (-v) or terse (-t) is
a good idea as at some point I'm bound to forget and add a plain printf
statement thus breaking the intended use case.

Having clearly defined behaviour rather than (ab)using stderr and the
fact it is not captured by $() seems sensible to me.

So my proposal would be:

Default output of just the package name:

$ nvidia-detect
kmod-nvidia-304xx

Verbose output (-v, --verbose) written to stdout and similar to the
present output:

$ nvidia-detect -v
Probing for supported NVIDIA devices...
[10de:0392] NVIDIA Corporation G73 [GeForce 7600 GS]
This device requires the legacy 304.xx NVIDIA driver kmod-nvidia-304xx


All errors and warning messages written to stderr.




More information about the elrepo mailing list