MCPcopy Create free account
hub / github.com/catboost/catboost / DoRead

Method DoRead

util/stream/pipe.cpp:46–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46size_t TPipeInput::DoRead(void* buf, size_t len) {
47 if (Impl_->Pipe_ == nullptr) {
48 return 0;
49 }
50
51 size_t bytesRead = ::fread(buf, 1, len, Impl_->Pipe_);
52 if (bytesRead == 0) {
53 int exitStatus = ::pclose(Impl_->Pipe_);
54 Impl_->Pipe_ = nullptr;
55 if (exitStatus == -1) {
56 ythrow TSystemError() << "pclose() failed";
57 } else if (exitStatus != 0) {
58 ythrow yexception() << "subprocess exited with non-zero status(" << exitStatus << ")";
59 }
60 }
61 return bytesRead;
62}
63
64TPipeOutput::TPipeOutput(const TString& command)
65 : TPipeBase(command, "w")

Callers

nothing calls this directly

Calls 2

IsOpenMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected