-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change return code of extract-rows #1510
Conversation
num_done > 0 is success. Updated the return statement to return 0 when successful.
POSIX utitilies use a zero return value to indicate success and a non-zero value to indicate failure. This is a pattern that most of the Kaldi utilities also follow, but extract-rows returns non-zero on success which breaks compatibility with bash options like set -e. Changed the return value to use zero to indicate success. Similar to extract-feature-segments.cc, assumed success when at least one segment is processed. |
src/featbin/extract-rows.cc
Outdated
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) { | |||
KALDI_LOG << "Processed " << num_done << " segments successfully; " | |||
<< "errors on " << num_err; | |||
|
|||
return (num_done > 0); | |||
return (num_done == 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was a bug; that code has not been used much so far.
thanks, but can you please change it to
(num_done > 0 ? 0 : 1)
which is how we normally write it?
returning the truth value causes me to do a double-take when looking at the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Changed the expression.
Changed the return statement to use the ternary operator
* 'master' of https://github.com/kaldi-asr/kaldi: [src] Cosmetic change: remove 'train.tra' from usage messages (kaldi-asr#1529) [src] cudamatrix: speed up AddColSumMat with transfrom reduce kernel template (kaldi-asr#1530) [build]: remove openfst check (kaldi-asr#1531) [build,src,doc] Modify get_version.sh to deal better with whitespace (avoid space in version); minor fixes (kaldi-asr#1526) [scripts,egs] Adding options for using PCA instead of LDA+MLLT for ivectors used in ASR. Results are reported in the default TDNN recipe in AMI. Updating steps/online/nnet2/{train_diag_ubm.sh,train_ivector_extractor.sh} so that they now backup the contents of their destination directory if it already exists. (kaldi-asr#1514) [src] (minor) Added missing SetZero() to NaturalGradientAffineComponent::Scale() if scale==0.0 (kaldi-asr#1522) [src,doc] Fix several unrelated minor problems. Thanks: gaoxinglong [src] Adding noexcept to hashing function objects (kaldi-asr#1519) [egs] Fix to egs/wsj/s5/run.sh (unset variable) (kaldi-asr#1517) [misc] remove eXecute permissions where not needed (kaldi-asr#1515) [src,scripts]: Several unrelated cosmetic changes [egs] fixes to babel pipeline; thanks to Fred Richardson (kaldi-asr#1509) [src] Fix exit code of extract-rows.cc (kaldi-asr#1510)
num_done > 0 is success. Updated the return statement to return 0 when successful.