diff --git a/libs/commandlib.cpp b/libs/commandlib.cpp index 4040d44a..21e5d5f3 100644 --- a/libs/commandlib.cpp +++ b/libs/commandlib.cpp @@ -33,12 +33,15 @@ #include #include +#include #include #include + bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){ char fullcmd[2048]; char *pCmd; + pid_t pid; #ifdef _DEBUG printf( "Q_Exec damnit\n" ); @@ -54,6 +57,17 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){ return true; break; case 0: + // XXX : if we run q3map2 with '-connect' - redirect stdout and stderr + // to /dev/null - aka build monitoring - as it's already going to + // be written to stdout via 'radiant/console.cpp → Sys_print + if ( cmdline != NULL && ( strstr( cmdline, "q3map2" ) != NULL ) && ( strstr( cmdline, "-connect" ) != NULL ) ) { + int devNullFd = open( "/dev/null", 0 ); + if ( devNullFd != -1 ) { + dup2( devNullFd, 1 ); + dup2( devNullFd, 2 ); + } + } + // always concat the command on linux if ( cmd ) { strcpy( fullcmd, cmd ); @@ -139,4 +153,4 @@ bool Q_mkdir( const char* path ){ std::error_code err; std::filesystem::create_directories( path, err ); return !err; -} \ No newline at end of file +}