mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-26 08:08:28 +03:00
Ensure Process::create is always checked as true before continue doing anything.
This commit is contained in:
@@ -596,12 +596,12 @@ void UIConsole::createDefaultCommands() {
|
||||
executeArr.erase( executeArr.begin() );
|
||||
std::string execute = String::join( executeArr );
|
||||
Process p;
|
||||
p.create( execute, Process::CombinedStdoutStderr | Process::getDefaultOptions() );
|
||||
std::string buffer;
|
||||
p.readAllStdOut( buffer, Seconds( 1 ) );
|
||||
auto lines = String::split( buffer );
|
||||
for ( const auto& line : lines )
|
||||
privPushText( line );
|
||||
if ( p.create( execute, Process::CombinedStdoutStderr | Process::getDefaultOptions() ) ) {
|
||||
std::string buffer;
|
||||
p.readAllStdOut( buffer, Seconds( 1 ) );
|
||||
String::readBySeparator( std::string_view{ buffer },
|
||||
[this]( std::string_view line ) { privPushText( line ); } );
|
||||
}
|
||||
} );
|
||||
addCommand( "crash_application_for_real", []( const auto& ) { std::terminate(); } );
|
||||
}
|
||||
|
||||
@@ -3660,14 +3660,15 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe
|
||||
{
|
||||
std::string lldbPath;
|
||||
Process p;
|
||||
p.create( "xcrun -f lldb" );
|
||||
p.readAllStdOut( lldbPath, Seconds( 5 ) );
|
||||
int retCode = -1;
|
||||
p.join( &retCode );
|
||||
if ( retCode == 0 && !lldbPath.empty() ) {
|
||||
String::trimInPlace( lldbPath, '\n' );
|
||||
if ( std::find( paths.begin(), paths.end(), lldbPath ) == paths.end() )
|
||||
paths.emplace_back( lldbPath );
|
||||
if ( p.create( "xcrun -f lldb" ) ) {
|
||||
p.readAllStdOut( lldbPath, Seconds( 5 ) );
|
||||
int retCode = -1;
|
||||
p.join( &retCode );
|
||||
if ( retCode == 0 && !lldbPath.empty() ) {
|
||||
String::trimInPlace( lldbPath, '\n' );
|
||||
if ( std::find( paths.begin(), paths.end(), lldbPath ) == paths.end() )
|
||||
paths.emplace_back( lldbPath );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1674,14 +1674,15 @@ static std::string findCommand( const std::string& findBinary, const std::string
|
||||
std::string findCmd = findBinary;
|
||||
String::replaceAll( findCmd, "${command}", cmd );
|
||||
Process p;
|
||||
p.create( findCmd );
|
||||
std::string path;
|
||||
p.readAllStdOut( path, Seconds( 5 ) );
|
||||
int retCode = -1;
|
||||
p.join( &retCode );
|
||||
if ( retCode == 0 && !path.empty() ) {
|
||||
String::trimInPlace( path, '\n' );
|
||||
return path;
|
||||
if ( p.create( findCmd ) ) {
|
||||
std::string path;
|
||||
p.readAllStdOut( path, Seconds( 5 ) );
|
||||
int retCode = -1;
|
||||
p.join( &retCode );
|
||||
if ( retCode == 0 && !path.empty() ) {
|
||||
String::trimInPlace( path, '\n' );
|
||||
return path;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user