ide: Fixed truncated output of internal console runs

This commit is contained in:
Mirek Fidler 2023-04-27 10:05:50 +02:00
parent 47c0f89e0a
commit 6ccd1d00de

View file

@ -147,22 +147,28 @@ int Console::Flush()
Slot& slot = processes[i];
if(!slot.process)
continue;
String s;
slot.process->Read(s);
if(!IsNull(s)) {
done_output = true;
if(slot.outfile)
slot.outfile->Put(s);
if(!slot.quiet) {
if(console_lock < 0 || console_lock == i) {
console_lock = i;
AppendOutput(s);
auto Read = [&] {
String s;
slot.process->Read(s);
if(!IsNull(s)) {
done_output = true;
if(slot.outfile)
slot.outfile->Put(s);
if(!slot.quiet) {
if(console_lock < 0 || console_lock == i) {
console_lock = i;
AppendOutput(s);
}
else
slot.output.Cat(s);
}
else
slot.output.Cat(s);
return true;
}
}
return false;
};
Read();
if(!slot.process->IsRunning()) {
while(Read());
Kill(i);
if(slot.exitcode != 0 && verbosebuild)
spooled_output.Cat("Error executing " + slot.cmdline + "\n");
@ -179,10 +185,12 @@ int Console::Flush()
int Console::Execute(One<AProcess> pick_ p, const char *command, Stream *out, bool q)
{
DLOG("Execute " << command);
Wait();
if(!Run(pick(p), command, out, q, 0))
return -1;
Wait();
Flush();
return processes[0].exitcode;
}