sensors-detect: Detect incorrect non-interactive runs

It is better to use option --auto for non-interactive runs of the
sensors-detect script than faking an input to get the default answers
to all questions.
This commit is contained in:
Jean Delvare committed 2013-09-11 11:46:48 +00:00
1 parent feb19f45c6
commit 5b6f3f26e0
2 files changed
+11 -1

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ SVN HEAD
Add detection of F71868A
Add a PCI ID for new family 15h AMD processors
Introduce automatic mode (--auto)
Detect incorrect non-interactive runs
3.3.4 (2013-05-27)
sensors.conf.5: Mention "sensors -u" to get the raw feature names
+10 -1
View File
@@ -2517,7 +2517,7 @@ sub read_answer
print "\n";
return "";
}
return <STDIN>;
return <STDIN> || "";
}
###################
@@ -7012,6 +7012,15 @@ sub main
}
unload_modules();
# Check if running non-interactively without --auto
if (!$opt{auto} && ! -t STDIN) {
print "***************************************************************\n".
"Warning: the preferred way to run this script non-interactively\n".
"is with option --auto. Other methods are discouraged and may\n".
"stop working at some point in the future.\n".
"***************************************************************\n\n";
}
}
sub cleanup_on_int