Hi Paul,

Did you try this:

    proc = wx.wxProcess()

    proc:Connect(wx.wxEVT_END_PROCESS,
      function(event)
          print("Hello - the process is over and won't be deleted.")
          -- event:Skip(true) <-- will crash since wxWidgets will delete it
too
          -- proc = nil
          -- collectgarbage( "collect" ) -- not necessary, but it tests the
problem
      end
    )

    proc:Redirect()
    wx.wxExecute( cmd, wx.wxEXEC_ASYNC, proc )

I get this code somewhere and work fine for me.

--
João Mendes de Oliveira Neto


2012/9/30 Paul K <paulclin...@yahoo.com>

> Hi All,
>
> I'm trying to read output from a program and am having trouble with
> the following three lines of code:
>
>       local proc = wx.wxProcess(wx.NULL, wx.wxPROCESS_REDIRECT)
>       local pid = wx.wxExecute(cmd, wx.wxEXEC_ASYNC, proc)
>       local streamin = proc:GetInputStream()
>
> The app crashes on any attempt to get input stream. The following code
> with EXEC_SYNC works fine though:
>
>       local pid = wx.wxExecute(cmd, wx.wxEXEC_SYNC)
>
> But this doesn't give me any way to access the output of the command I
> execute.
>
> I suspect the problem is in the first parameter in wxProcess:
> wx.wxProcess(wx.NULL, but I don't see any other way to not provide
> wxEvtHandler or create a dummy one (replacing wx.NULL with
> wx.wxEvtHandler() has the same effect: the app crashes).
>
> This is all on windows 7 running fairly recent 2.8.12.2 code. I'd
> appreciate any ideas on how to get program output. Thanks.
>
> Paul.
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> wxlua-users mailing list
> wxlua-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wxlua-users
>
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to