Embracing branches

This commit is contained in:
Benny Baumann
2020-11-01 01:09:51 +01:00
parent 61e14d4bb2
commit 45869513bf
46 changed files with 656 additions and 277 deletions

View File

@ -61,8 +61,11 @@ void TraceScreen_delete(Object* cast) {
kill(this->child, SIGTERM);
waitpid(this->child, NULL, 0);
}
if (this->strace)
if (this->strace) {
fclose(this->strace);
}
CRT_enableDelay();
free(InfoScreen_done((InfoScreen*)this));
}
@ -144,9 +147,11 @@ void TraceScreen_updateTrace(InfoScreen* super) {
tv.tv_sec = 0;
tv.tv_usec = 500;
int ready = select(fd_strace + 1, &fds, NULL, NULL, &tv);
size_t nread = 0;
if (ready > 0 && FD_ISSET(fd_strace, &fds))
nread = fread(buffer, 1, sizeof(buffer) - 1, this->strace);
if (nread && this->tracing) {
const char* line = buffer;
buffer[nread] = '\0';
@ -167,8 +172,9 @@ void TraceScreen_updateTrace(InfoScreen* super) {
buffer[nread] = '\0';
this->contLine = true;
}
if (this->follow)
Panel_setSelected(this->super.display, Panel_size(this->super.display)-1);
if (this->follow) {
Panel_setSelected(this->super.display, Panel_size(this->super.display) - 1);
}
}
}