eepp: Improvements in Process. Some minor performance improvements.

ecode : Fixes in XML Tools. Fixes in Linter Plugin.
This commit is contained in:
Martín Lucas Golini
2023-09-28 01:05:15 -03:00
parent 4286976099
commit 8612eb2721
15 changed files with 217 additions and 125 deletions

View File

@@ -310,8 +310,7 @@ const std::vector<FormatterPlugin::Formatter>& FormatterPlugin::getFormatters()
return mFormatters;
}
FormatterPlugin::Formatter
FormatterPlugin::getFormatterForLang( const std::string& lang ) {
FormatterPlugin::Formatter FormatterPlugin::getFormatterForLang( const std::string& lang ) {
for ( const auto& formatter : mFormatters ) {
for ( const auto& clang : formatter.languages ) {
if ( clang == lang ) {
@@ -428,14 +427,9 @@ void FormatterPlugin::runFormatter( UICodeEditor* editor, const Formatter& forma
String::replaceAll( cmd, "$FILENAME", "\"" + path + "\"" );
Process process;
if ( process.create( cmd ) ) {
std::string buffer( 1024, '\0' );
std::string data;
unsigned bytesRead = 0;
int returnCode;
do {
bytesRead = process.readStdOut( buffer );
data += buffer.substr( 0, bytesRead );
} while ( bytesRead != 0 && process.isAlive() && !mShuttingDown );
std::string data;
process.readAllStdOut( data );
if ( mShuttingDown ) {
process.kill();