From 31480e64eeec19f98424be8947d30c49ee1827da Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Thu, 30 Jan 2014 18:17:31 +0000 Subject: [PATCH] "script help (lldb.SBThread)" output stops before all output is displayed. Fixed now. llvm-svn: 200476 --- .../Interpreter/ScriptInterpreterPython.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index a2740cf96e10..fe81e67c73c0 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 conn_ap(new ConnectionFileDescriptor(pipe_fds[0], false)); + std::unique_ptr 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]); }