summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-01-06 17:48:19 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2025-01-06 17:48:19 +0100
commit05a15ed660f8b43c85242fed1a863853e8c749b3 (patch)
tree2aaec389e043cf20637ce8a9d7d3ac394dae836e
parent78c5477b3989d67169de2d05665adfb801caab23 (diff)
Reduce chance of lines being cut and mixed up when printing from the task threads.
-rw-r--r--src/task_ar.cc3
-rw-r--r--src/task_cc.cc11
-rw-r--r--src/task_fn.cc7
-rw-r--r--src/task_ld.cc3
-rw-r--r--src/task_so.cc3
5 files changed, 16 insertions, 11 deletions
diff --git a/src/task_ar.cc b/src/task_ar.cc
index b16a2f9..09403bb 100644
--- a/src/task_ar.cc
+++ b/src/task_ar.cc
@@ -105,7 +105,8 @@ int TaskAR::runInner()
if(settings.verbose == 0)
{
- std::cout << "AR => " << targetFile().string() << std::endl;
+ std::string output = "AR => " + targetFile().string() + '\n';
+ std::cout << output << std::flush;
}
const auto& c = ctor::get_configuration();
diff --git a/src/task_cc.cc b/src/task_cc.cc
index e1f3023..9a801b5 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -175,22 +175,23 @@ int TaskCC::runInner()
if(settings.verbose == 0)
{
+ std::string output;
switch(sourceLanguage())
{
case ctor::language::c:
- std::cout << "CC ";
+ output = "CC ";
break;
case ctor::language::cpp:
- std::cout << "CXX ";
+ output = "CXX ";
break;
case ctor::language::automatic:
case ctor::language::assembler:
// Only c/c++ handled by this task type.
break;
}
- std::cout <<
- sourceFile.lexically_normal().string() << " => " <<
- targetFile().lexically_normal().string() << std::endl;
+ output += sourceFile.lexically_normal().string() + " => " +
+ targetFile().lexically_normal().string() + '\n';
+ std::cout << output << std::flush;
}
const auto& cfg = ctor::get_configuration();
diff --git a/src/task_fn.cc b/src/task_fn.cc
index 2fa0ad6..873dc44 100644
--- a/src/task_fn.cc
+++ b/src/task_fn.cc
@@ -68,9 +68,10 @@ int TaskFn::runInner()
if(settings.verbose >= 0)
{
- std::cout << "Fn" << " " <<
- sourceFile.lexically_normal().string() << " => " <<
- targetFile().lexically_normal().string() << std::endl;
+ std::string output = "Fn " +
+ sourceFile.lexically_normal().string() + " => " +
+ targetFile().lexically_normal().string() + '\n';
+ std::cout << output << std::flush;
}
return config.function(sourceFile.string(),
diff --git a/src/task_ld.cc b/src/task_ld.cc
index c8cd1ea..31ee8c0 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -123,7 +123,8 @@ int TaskLD::runInner()
if(settings.verbose == 0)
{
- std::cout << "LD => " << targetFile().string() << std::endl;
+ std::string output = "LD => " + targetFile().string() + '\n';
+ std::cout << output << std::flush;
}
auto tool = compiler();
diff --git a/src/task_so.cc b/src/task_so.cc
index 75b5f3c..eecd7aa 100644
--- a/src/task_so.cc
+++ b/src/task_so.cc
@@ -110,7 +110,8 @@ int TaskSO::runInner()
if(settings.verbose == 0)
{
- std::cout << "LD => " << targetFile().string() << std::endl;
+ std::string output = "LD => " + targetFile().string() + '\n';
+ std::cout << output << std::flush;
}
auto tool = compiler();