summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/source/Interpreter/ScriptInterpreterPython.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
index a2740cf96e1..fe81e67c73c 100644
--- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp
@@ -571,7 +571,7 @@ ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObjec
int err = pipe(pipe_fds);
if (err == 0)
{
- std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe_fds[0], false));
+ std::unique_ptr<ConnectionFileDescriptor> conn_ap(new ConnectionFileDescriptor(pipe_fds[0], true));
if (conn_ap->IsConnected())
{
output_comm.SetConnection(conn_ap.release());
@@ -654,13 +654,15 @@ ScriptInterpreterPython::ExecuteOneLine (const char *command, CommandReturnObjec
if (pipe_fds[0] != -1)
{
- // Close write end of pipe so our communication thread exits
+ // Close the write end of the pipe since we are done with our
+ // one line script. This should cause the read thread that
+ // output_comm is using to exit
+ output_file_sp->GetFile().Close();
+ // The close above should cause this thread to exit when it gets
+ // to the end of file, so let it get all its data
+ output_comm.JoinReadThread();
+ // Now we can close the read end of the pipe
output_comm.Disconnect();
- output_comm.StopReadThread();
- // Close the read end of the pipe and don't close the write end
- // since we called fdopen on it and gave the ownership to the
- // connection in "output_comm"
- ::close (pipe_fds[0]);
}
OpenPOWER on IntegriCloud