安装输出改为实时输出
This commit is contained in:
@@ -43,9 +43,10 @@ std::pair<int,std::string> execute_command(const std::string& command){
|
|||||||
throw std::runtime_error("popen() failed!");
|
throw std::runtime_error("popen() failed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the output a line at a time - output it.
|
// Read and tee to stdout so logs appear as the subprocess writes (not only after exit).
|
||||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
|
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
|
||||||
result += buffer.data();
|
result += buffer.data();
|
||||||
|
std::cout << buffer.data() << std::flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the return code
|
// Get the return code
|
||||||
@@ -264,7 +265,7 @@ void fastweb::uninstall_module(std::string ini_filepath, std::string name)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"卸载失败:"<<std::endl;
|
std::cout<<"卸载失败:"<<std::endl;
|
||||||
std::cout<<err<<std::endl;
|
// std::cout<<err<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -387,8 +388,8 @@ void fastweb::install_module_linux(fastweb::module_info info)
|
|||||||
if(code != 0)
|
if(code != 0)
|
||||||
{
|
{
|
||||||
std::cerr<<"安装失败:"<<std::endl;
|
std::cerr<<"安装失败:"<<std::endl;
|
||||||
std::cerr<<cmd<<std::endl;
|
// std::cerr<<cmd<<std::endl;
|
||||||
std::cerr<<err<<std::endl;
|
// std::cerr<<err<<std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -405,8 +406,8 @@ void fastweb::install_module_linux(fastweb::module_info info)
|
|||||||
if(code != 0)
|
if(code != 0)
|
||||||
{
|
{
|
||||||
std::cerr<<"克隆仓库失败:"<<std::endl;
|
std::cerr<<"克隆仓库失败:"<<std::endl;
|
||||||
std::cerr << cmd << std::endl;
|
// std::cerr << cmd << std::endl;
|
||||||
std::cerr << result << std::endl;
|
// std::cerr << result << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,8 +418,8 @@ void fastweb::install_module_linux(fastweb::module_info info)
|
|||||||
if(code2 != 0)
|
if(code2 != 0)
|
||||||
{
|
{
|
||||||
std::cerr<<"执行安装命令失败:"<<std::endl;
|
std::cerr<<"执行安装命令失败:"<<std::endl;
|
||||||
std::cerr << cmd << std::endl;
|
// std::cerr << cmd << std::endl;
|
||||||
std::cerr << result2 << std::endl;
|
// std::cerr << result2 << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +445,7 @@ void fastweb::install_module_linux(fastweb::module_info info)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<<"安装失败:"<<std::endl;
|
std::cout<<"安装失败:"<<std::endl;
|
||||||
std::cout<<err<<std::endl;
|
// std::cout<<err<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user