> On Sep 22, 2014, at 11:30 AM, Zachary Turner <ztur...@google.com> wrote: > > 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. > > 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. > > 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?
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. _______________________________________________ lldb-dev mailing list lldb-dev@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev