<div dir="ltr">Someone creating the ProcessLaunchInfo could set a custom callback though, and it seems like it could lead to confusion when this is never invoked. Probably never happens in practice, but that was the main source of my confusion.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 22, 2014 at 11:34 AM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Sep 22, 2014, at 11:30 AM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>
><br>
> The only way to wait for a process to exit is calling WaitForSingleObject() with the handle. You can specify a timeout to that function, and INFINITE is one possible value. However, it seems like the primary use case for LLDB waiting for a process to exit is to fire off the exit callback asynchronously. In that case Windows, like other platforms, will probably need to create a background thread, then WaitForSingleObject() on the background thread, then fire the callback after it returns.<br>
><br>
> What I was thinking is have the HostProcess provide a method called BlockUntilExit() which can be used anywhere (even from the main thread) should the caller desire it, but when launching a process we would create a thread for on each platform that just calls this method on the HostProcess, then issues the callback. This would unify alot of code currently spread across the different Host.[cpp/mm] files.<br>
><br>
> One thing that still eludes me though, is that when processes are launched using Applescript, no monitoring thread is created, and it looks at least like the callback is never invoked on these processes. Is this by design, a bug, or am I misreading the code?<br>
<br>
</span>It is by design. AppleScript is used to launch a process in a separate terminal window (allowing you to debug a "vi" or "emacs" style program that wants to take over the terminal and use all sorts of fancy terminal settings). The shell it runs in will reap the process and also give you a prompt back in the terminal so you can check the return value from there using the $? shell builtin variable.<br>
<br>
<br>
</blockquote></div><br></div>