Add an 'internal' flag when launching processes, to reduce log spam

This commit is contained in:
baldurk
2018-01-26 15:29:58 +00:00
parent ddb8e76add
commit 24db8dbffc
6 changed files with 25 additions and 21 deletions
+2 -2
View File
@@ -311,7 +311,7 @@ Process::ProcessResult execScript(const string &script, const string &args,
RDCLOG("SCRIPT: %s", script.c_str());
Process::ProcessResult result;
Process::LaunchScript(script.c_str(), workDir.c_str(), args.c_str(), &result);
Process::LaunchScript(script.c_str(), workDir.c_str(), args.c_str(), true, &result);
return result;
}
Process::ProcessResult execCommand(const string &exe, const string &args,
@@ -320,7 +320,7 @@ Process::ProcessResult execCommand(const string &exe, const string &args,
RDCLOG("COMMAND: %s '%s'", exe.c_str(), args.c_str());
Process::ProcessResult result;
Process::LaunchProcess(exe.c_str(), workDir.c_str(), args.c_str(), &result);
Process::LaunchProcess(exe.c_str(), workDir.c_str(), args.c_str(), true, &result);
return result;
}
Process::ProcessResult adbExecCommand(const string &device, const string &args, const string &workDir)
+4 -4
View File
@@ -51,7 +51,7 @@ static bool IsSupported(ShaderEncoding encoding)
std::string vc = LocatePluginFile(pluginPath, virtualcontext_name);
Process::ProcessResult result = {};
Process::LaunchProcess(vc.c_str(), dirname(vc).c_str(), "", &result);
Process::LaunchProcess(vc.c_str(), dirname(vc).c_str(), "", true, &result);
// running with no parameters produces an error, so if there's no output something went wrong.
if(result.strStdout.empty())
@@ -66,7 +66,7 @@ static bool IsSupported(ShaderEncoding encoding)
std::string amdspv = LocatePluginFile(pluginPath, amdspv_name);
Process::ProcessResult result = {};
Process::LaunchProcess(amdspv.c_str(), dirname(amdspv).c_str(), "", &result);
Process::LaunchProcess(amdspv.c_str(), dirname(amdspv).c_str(), "", true, &result);
// running with no parameters produces help text, so if there's no output something went wrong.
if(result.strStdout.empty())
@@ -195,7 +195,7 @@ std::string DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, cons
std::string amdspv = LocatePluginFile(pluginPath, amdspv_name);
Process::ProcessResult result = {};
Process::LaunchProcess(amdspv.c_str(), dirname(amdspv).c_str(), cmdLine.c_str(), &result);
Process::LaunchProcess(amdspv.c_str(), dirname(amdspv).c_str(), cmdLine.c_str(), true, &result);
if(result.strStdout.find("SUCCESS") == std::string::npos)
{
@@ -348,7 +348,7 @@ std::string DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const
std::string vc = LocatePluginFile(pluginPath, virtualcontext_name);
Process::ProcessResult result = {};
Process::LaunchProcess(vc.c_str(), dirname(vc).c_str(), cmdLine.c_str(), &result);
Process::LaunchProcess(vc.c_str(), dirname(vc).c_str(), cmdLine.c_str(), true, &result);
if(result.retCode != 0 || result.strStdout.find("Error") != string::npos ||
result.strStdout.empty() || !FileIO::exists(outPath.c_str()))
+2 -2
View File
@@ -67,9 +67,9 @@ struct ProcessResult
string strStdout, strStderror;
int retCode;
};
uint32_t LaunchProcess(const char *app, const char *workingDir, const char *cmdLine,
uint32_t LaunchProcess(const char *app, const char *workingDir, const char *cmdLine, bool internal,
ProcessResult *result = NULL);
uint32_t LaunchScript(const char *script, const char *workingDir, const char *args,
uint32_t LaunchScript(const char *script, const char *workingDir, const char *args, bool internal,
ProcessResult *result = NULL);
uint32_t LaunchAndInjectIntoProcess(const char *app, const char *workingDir, const char *cmdLine,
const rdcarray<EnvironmentModification> &env, const char *logfile,
+3 -3
View File
@@ -417,7 +417,7 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModi
}
uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const char *cmdLine,
ProcessResult *result)
bool internal, ProcessResult *result)
{
if(app == NULL || app[0] == 0)
{
@@ -469,12 +469,12 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c
}
uint32_t Process::LaunchScript(const char *script, const char *workingDir, const char *argList,
ProcessResult *result)
bool internal, ProcessResult *result)
{
// Change parameters to invoke command interpreter
string args = "-lc \"" + string(script) + " " + string(argList) + "\"";
return LaunchProcess("bash", workingDir, args.c_str(), result);
return LaunchProcess("bash", workingDir, args.c_str(), internal, result);
}
uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir,
+13 -9
View File
@@ -395,7 +395,8 @@ void InjectFunctionCall(HANDLE hProcess, uintptr_t renderdoc_remote, const char
}
static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, const char *cmdLine,
HANDLE *phChildStdOutput_Rd, HANDLE *phChildStdError_Rd)
bool internal, HANDLE *phChildStdOutput_Rd,
HANDLE *phChildStdError_Rd)
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
@@ -472,7 +473,8 @@ static PROCESS_INFORMATION RunProcess(const char *app, const char *workingDir, c
si.hStdError = hChildStdError_Wr;
}
RDCLOG("Running process %s", app);
if(!internal)
RDCLOG("Running process %s", app);
BOOL retValue = CreateProcessW(NULL, paramsAlloc, &pSec, &tSec,
true, // Need to inherit handles for ReadFile to read stdout
@@ -921,12 +923,13 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, const rdcarray<EnvironmentModi
}
uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const char *cmdLine,
ProcessResult *result)
bool internal, ProcessResult *result)
{
HANDLE hChildStdOutput_Rd, hChildStdError_Rd;
PROCESS_INFORMATION pi = RunProcess(app, workingDir, cmdLine, result ? &hChildStdOutput_Rd : NULL,
result ? &hChildStdError_Rd : NULL);
PROCESS_INFORMATION pi =
RunProcess(app, workingDir, cmdLine, internal, result ? &hChildStdOutput_Rd : NULL,
result ? &hChildStdError_Rd : NULL);
if(pi.dwProcessId == 0)
{
@@ -934,7 +937,8 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c
return 0;
}
RDCLOG("Launched process '%s' with '%s'", app, cmdLine);
if(!internal)
RDCLOG("Launched process '%s' with '%s'", app, cmdLine);
ResumeThread(pi.hThread);
@@ -981,12 +985,12 @@ uint32_t Process::LaunchProcess(const char *app, const char *workingDir, const c
}
uint32_t Process::LaunchScript(const char *script, const char *workingDir, const char *argList,
ProcessResult *result)
bool internal, ProcessResult *result)
{
// Change parameters to invoke command interpreter
string args = "/C " + string(script) + " " + string(argList);
return LaunchProcess("cmd.exe", workingDir, args.c_str(), result);
return LaunchProcess("cmd.exe", workingDir, args.c_str(), internal, result);
}
uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workingDir,
@@ -1005,7 +1009,7 @@ uint32_t Process::LaunchAndInjectIntoProcess(const char *app, const char *workin
return 0;
}
PROCESS_INFORMATION pi = RunProcess(app, workingDir, cmdLine, NULL, NULL);
PROCESS_INFORMATION pi = RunProcess(app, workingDir, cmdLine, false, NULL, NULL);
if(pi.dwProcessId == 0)
return 0;
+1 -1
View File
@@ -130,7 +130,7 @@ static uint32_t LaunchReplayUI(uint32_t connectTargetControl, const char *cmdlin
cmd += StringFormat::Fmt(" --targetcontrol localhost:%u",
RenderDoc::Inst().GetTargetControlIdent());
return Process::LaunchProcess(replayapp.c_str(), "", cmd.c_str());
return Process::LaunchProcess(replayapp.c_str(), "", cmd.c_str(), false);
}
static void SetActiveWindow(void *device, void *wndHandle)