fix stdin input

This commit is contained in:
tqchen
2015-03-08 12:22:11 -07:00
parent 3258bcf531
commit 2fbda812bc
5 changed files with 16 additions and 14 deletions

View File

@@ -78,7 +78,7 @@ class HDFSStream : public utils::ISeekStream {
}
inline void Close(void) {
if (fp_ != NULL) {
if (hdfsCloseFile(fs_, fp_) == 0) {
if (hdfsCloseFile(fs_, fp_) == -1) {
int errsv = errno;
utils::Error("HDFSStream.Close Error:%s", strerror(errsv));
}

View File

@@ -140,8 +140,10 @@ class LineSplitBase : public InputSplit {
class SingleFileSplit : public InputSplit {
public:
explicit SingleFileSplit(const char *fname) {
if (!strcmp(fname, "stdin")) {
use_stdin_ = true;
if (!strcmp(fname, "stdin")) {
#ifndef RABIT_STRICT_CXX98_
use_stdin_ = true; fp_ = stdin;
#endif
}
if (!use_stdin_) {
fp_ = utils::FopenCheck(fname, "r");