@ -33,7 +33,6 @@ Builder::Builder(GUI &g, GameEngine &engine)
}
FILE * start_command ( string & build_cmd ) {
println ( " >>>>>>>>> start_command {} " , build_cmd ) ;
FILE * build_out = popen ( build_cmd . c_str ( ) , " r " ) ;
dbc : : check ( build_out ! = nullptr , " Failed to run command. " ) ;
return build_out ;
@ -51,11 +50,6 @@ string read_line(FILE *build_out, bool &done_out) {
}
}
bool end_build ( FILE * build_out , GUI & gui , string & build_cmd ) {
int rc = pclose ( build_out ) ;
return rc = = 0 ;
}
MatchResult Builder : : parse_line ( const string & line ) {
std : : regex err_re ( " (.*?):([0-9]+):([0-9]+): \\ s*(.*?): \\ s*(.*) \n * " ) ;
@ -76,24 +70,12 @@ MatchResult Builder::parse_line(const string &line) {
}
}
void Builder : : run ( ) {
int rc = gui . main_loop ( game , [ & ] {
event ( GO ) ;
return 0 ;
} ) ;
if ( rc ! = 0 ) println ( " ERROR IN GUI " ) ;
event ( QUIT ) ;
}
void Builder : : building ( BuildEvent ev ) {
println ( " >>> BUILDING " ) ;
// check if there's output
if ( build_done ) {
bool good = end_build ( build_out , gui , build_cmd ) ;
int rc = pclose ( build_out ) ;
if ( good ) {
if ( rc = = 0 ) {
gui . build_works ( ) ;
} else {
// BUG: make it not play two sounds