<rdar://problem/12446320> Fixing an issue with our Driver where setting an immediate output would not cause suppression of the final printout. This allows effective output redirection for Python commands

llvm-svn: 166058
This commit is contained in:
Enrico Granata
2012-10-16 20:57:12 +00:00
parent 981d4dfa0f
commit cd4d24d5e9
6 changed files with 84 additions and 13 deletions

View File

@@ -268,7 +268,7 @@ SBCommandReturnObject::SetImmediateOutputFile (FILE *fh)
if (m_opaque_ap.get())
m_opaque_ap->SetImmediateOutputFile (fh);
}
void
SBCommandReturnObject::SetImmediateErrorFile (FILE *fh)
{
@@ -285,6 +285,46 @@ SBCommandReturnObject::PutCString(const char* string, int len)
}
}
const char *
SBCommandReturnObject::GetOutput (bool only_if_no_immediate)
{
if (!m_opaque_ap.get())
return NULL;
if (only_if_no_immediate == false || m_opaque_ap->GetImmediateOutputStream().get() == NULL)
return GetOutput();
return NULL;
}
const char *
SBCommandReturnObject::GetError (bool only_if_no_immediate)
{
if (!m_opaque_ap.get())
return NULL;
if (only_if_no_immediate == false || m_opaque_ap->GetImmediateErrorStream().get() == NULL)
return GetError();
return NULL;
}
size_t
SBCommandReturnObject::GetErrorSize (bool only_if_no_immediate)
{
if (!m_opaque_ap.get())
return NULL;
if (only_if_no_immediate == false || m_opaque_ap->GetImmediateErrorStream().get() == NULL)
return GetErrorSize();
return NULL;
}
size_t
SBCommandReturnObject::GetOutputSize (bool only_if_no_immediate)
{
if (!m_opaque_ap.get())
return NULL;
if (only_if_no_immediate == false || m_opaque_ap->GetImmediateOutputStream().get() == NULL)
return GetOutputSize();
return NULL;
}
size_t
SBCommandReturnObject::Printf(const char* format, ...)
{