Added some logs.

This commit is contained in:
Martín Lucas Golini
2024-04-25 16:13:46 -03:00
parent e55535cc7c
commit fa580caa00
2 changed files with 27 additions and 14 deletions

View File

@@ -728,25 +728,30 @@ void ProjectBuildManager::runConfig( StatusAppOutputController* saoc ) {
}
}
if ( nullptr == run )
if ( nullptr == run ) {
Log::info( "No run configuration found to run with runName: %s", mConfig.runName );
return;
}
ProjectBuildCommand finalBuild( build->replaceVars( *run ) );
replaceDynamicVars( finalBuild );
auto cmd = finalBuild.cmd + " " + finalBuild.args;
auto cmd = String::trim( finalBuild.cmd ) + " " + finalBuild.args;
if ( finalBuild.runInTerminal ) {
UITerminal* term = mApp->getTerminalManager()->createTerminalInSplitter(
finalBuild.workingDir, false );
Log::info( "Running \"%s\" in terminal", cmd );
if ( term == nullptr || term->getTerm() == nullptr ) {
mApp->getTerminalManager()->openInExternalTerminal( cmd, finalBuild.workingDir );
} else {
term->executeFile( cmd );
}
} else {
// Sys::execute( cmd, finalBuild.workingDir );
Log::info( "Running \"%s\" in app", cmd );
finalBuild.config = build->getConfig();
saoc->run( finalBuild, {} );
}
} else {
Log::info( "ProjectBuildManager::runConfig is already running or isRunningApp() is true" );
}
}

View File

@@ -339,17 +339,24 @@ if not %autoclose%==1 pause
)shellscript";
if ( !cmd.empty() && !scriptsPath.empty() ) {
std::string runHelperPath = scriptsPath + "ecode-run-helper.bat";
if ( !FileSystem::fileExists( runHelperPath ) )
FileSystem::fileWrite( runHelperPath, RUN_HELPER );
std::string cmdDir = String::trim( FileSystem::fileRemoveFileName( cmd ) );
if ( cmdDir.empty() )
cmdDir = workingDir;
std::string cmdFile = String::trim( FileSystem::fileNameFromPath( cmd ) );
auto fcmd = "cmd.exe /q /c " + quoteString( "\"" + runHelperPath + "\" \"" + cmdDir +
"\" 0 \"" + cmdFile + "\"" );
Log::info( "Running: %s", fcmd );
Sys::execute( fcmd, workingDir );
return;
bool canContinue = true;
if ( !FileSystem::fileExists( runHelperPath ) ) {
if ( !FileSystem::fileWrite( runHelperPath, RUN_HELPER ) )
canContinue = false;
}
if ( canContinue ) {
std::string cmdDir = String::trim( FileSystem::fileRemoveFileName( cmd ) );
if ( cmdDir.empty() )
cmdDir = workingDir;
std::string cmdFile = String::trim( FileSystem::fileNameFromPath( cmd ) );
auto fcmd = "cmd.exe /q /c " + quoteString( "\"" + runHelperPath + "\" \"" + cmdDir +
"\" 0 \"" + cmdFile + "\"" );
Log::info( "Running: %s", fcmd );
Sys::execute( fcmd, workingDir );
return;
} else {
Log::info( "Couldn't write runHelperPath %s", runHelperPath );
}
}
std::vector<std::string> options;
@@ -406,6 +413,7 @@ static void openExternal( const std::string&, const std::string& cmd, const std:
void TerminalManager::openInExternalTerminal( const std::string& cmd,
const std::string& workingDir ) {
Log::info( "Trying to open in external terminal: %s %s", cmd, workingDir );
openExternal( mApp->termConfig().shell, cmd, mApp->getScriptsPath(), workingDir );
}