[Gambas-user] help with EXEC usage

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Mar 25 19:21:11 CET 2011


This seems to work... but it is not very nice code, as it doesn't make
distinction of what instance of "get_iplayer" or "mplayer
you are dealing  with...
Also it leaves some trash (get_iplayer doesn't take care of it's trashes!)
to ~/.get_iplayer.
Maybe get_iplayer should be killed with some other signal.

PUBLIC SUB btnStop_Click()
DIM pid1 AS String
DIM pid2 AS String

    IF hProc.State = Process.Running THEN
      SHELL ("pidof get_iplayer") TO pid1
      SHELL ("pidof mplayer") TO pid2
      DEBUG pid1;; pid2
      SHELL "kill " & pid1 & " " & pid2
      hProc.Kill()
    ENDIF

END

Jussi


2011/3/25 Benoît Minisini <gambas at ...1...>

> > I think this is what Benoit means;
> >
> > PUBLIC hProc AS Process
> >
> > PUBLIC SUB btnPlay_Click()
> >     hProc = SHELL ("get_iplayer --stream 13280 | mplayer -cache 3072 -")
> > FOR WRITE
> > END
> >
> > PUBLIC SUB btnStop_Click()
> >
> >     IF hProc.State = Process.Running THEN
> >     DEBUG hProc.Handle
> >     SHELL "kill -s HUP " & CStr(hProc.Handle)
> >     ENDIF
> >
> > END
> >
> >
> > However it doesn't work with me, differences between distributions?
> > But maybe with different signal... or then with pgrep as I described
> > earlier.
> >
> > Gambas 2.22 rev 3527 @ Ubuntu 10.10 64bit
> > Jussi
> >
>
> I tried with just mplayer, and "kill -SIGHUP". Don't know if that makes a
> difference...
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list