[lldb/ScriptInterpreter] Let the IORedirect factory handle IO being disabled.

Have one factory method that decides how to initialize the
ScriptInterpreterIORedirect object based on whether IO is enabled or
disabled.
This commit is contained in:
Jonas Devlieghere
2020-06-25 09:51:55 -07:00
parent 79d7e9c7d0
commit 842283652e
3 changed files with 12 additions and 18 deletions

View File

@@ -912,10 +912,8 @@ bool ScriptInterpreterPythonImpl::ExecuteOneLine(
// we use the following more complicated method to pass the command string
// directly down to Python.
llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
io_redirect_or_error =
options.GetEnableIO()
? ScriptInterpreterIORedirect::Create(m_debugger, result)
: ScriptInterpreterIORedirect::Create();
io_redirect_or_error = ScriptInterpreterIORedirect::Create(
options.GetEnableIO(), m_debugger, result);
if (!io_redirect_or_error) {
if (result)
result->AppendErrorWithFormatv(