From: Paul K <pau...@ya...> - 2012-10-02 04:54:48
|
Hi John, > Please read the description of wxProcess where they describe how to > use the streams. You will also want to check the status of the process > before trying to use it as well. Is there any particular problem with the logic I described? I know how to use streams (I use it in other parts of the application), but I wanted to have something very simple here (and ideally synchronous). I oversimplified the logic (there is also CanRead() and few other things), but the idea is as I described. I do check if the returned value is not nil. Is there anything else you suggest I need to do? Thanks. Paul. ZeroBrane Studio - slick Lua IDE and debugger for Windows, OSX, and Linux - http://studio.zerobrane.com/ On Mon, Oct 1, 2012 at 8:49 PM, John Labenski <jla...@gm...> wrote: > On Mon, Oct 1, 2012 at 11:41 AM, Paul K <pau...@ya...> wrote: >> Hi João, >> >> Thank you for the solution. I ended up using the following, as it >> allows me to implemented synchronous processing (while still using >> EXEC_ASYNC): >> >> local proc = wx.wxProcess.Open(cmd) -- this is using EXEC_ASYNC >> proc:Redirect() >> local streamin = proc:GetInputStream() >> local str = streamin:Read(4096) >> >> :Read() blocks waiting for input, which is exactly what I need. > > Please read the description of wxProcess where they describe how to > use the streams. You will also want to check the status of the process > before trying to use it as well. > > http://docs.wxwidgets.org/stable/wx_wxprocess.html#wxprocessredirect > > Regards, > John > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |