MCPcopy Create free account
hub / github.com/KDE/kdevelop / OutReceived

Method OutReceived

plugins/debuggercommon/stty.cpp:281–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279// **************************************************************************
280
281void STTY::OutReceived(int f)
282{
283#ifndef Q_OS_WIN
284 char buf[1024];
285 int n;
286
287 // read until socket is empty. We shouldn't be receiving a continuous
288 // stream of data, so the loop is unlikely to cause problems.
289 while ((n = ::read(f, buf, sizeof(buf)-1)) > 0) {
290 *(buf+n) = 0; // a standard string
291 QByteArray ba(buf);
292 emit OutOutput(ba);
293 }
294 // Note: for some reason, n can be 0 here.
295 // I can understand that non-blocking read returns 0,
296 // but I don't understand how OutReceived can be even
297 // called when there's no input.
298 if (n == 0 /* eof */
299 || (n == -1 && errno != EAGAIN))
300 {
301 // Found eof or error. Disable socket notifier, otherwise Qt
302 // will repeatedly call this method, eating CPU
303 // cycles.
304 out->setEnabled(false);
305 }
306#endif
307}
308
309void STTY::readRemaining()
310{

Callers

nothing calls this directly

Calls 2

readFunction · 0.50
setEnabledMethod · 0.45

Tested by

no test coverage detected