<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Python API: Unable to detach a process in running state."
   href="https://llvm.org/bugs/show_bug.cgi?id=27238">27238</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Python API: Unable to detach a process in running state.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alexis.kofman@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code used to work before xcode 7.3 lldb-350.0.21.3. Now it seems
that the process can't be detached anymore. There is no error, it just hangs
when trying to detach and never execute the os._exit(0). Any thought ?

safequit_command(debugger, command, result, internal_dict):
    process = lldb.target.process
    listener = debugger.GetListener()
    listener.StartListeningForEvents(process.GetBroadcaster(),
lldb.SBProcess.eBroadcastBitStateChanged | lldb.SBProcess.eBroadcastBitSTDOUT |
lldb.SBProcess.eBroadcastBitSTDERR)
    event = lldb.SBEvent()
    while True:
        if listener.WaitForEvent(1, event) and
lldb.SBProcess.EventIsProcessEvent(event):
            state = lldb.SBProcess.GetStateFromEvent(event)
        else:
            state = process.GetState()
        if state == lldb.eStateRunning:
            process.Detach()
            os._exit(0)
        elif state > lldb.eStateRunning:
            os._exit(state)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>