[Gambas-user] process.id

Benoit Minisini gambas at ...1...
Tue May 24 18:02:24 CEST 2005


On Thursday 19 May 2005 10:31, Matthias Laur wrote:
> Hello,
>
> I want to store a mpg file from s-video-in for 10 sec with the following
> command
>
>
>
> Shell "cat /dev/video0 > myfile.mpg" AS myprocess
>
> Wait (10)
>
> myprocess.kill
>
>
>
> But after then the process was still alive.
>
>
>
> Then I try:
>
>
>
> Shell "kill " & myprocess.id
>
>
>
> With no access. The process was still alive.
>
>
>
> Then I saw that the number that myprocess.id returns was 1 lower then the
> number that the command "fuser /dev/video0" in the bash returns.
>
>
>
> So at last I try:
>
>
>
> Shell "kill " & cstr(myprocess.id +1)
>
>
>
> And it works. Can you tell me why?
>
> I'm using Gambas 1.0.6
>
>
>
> Greets from Hamburg
>
> Matthias

I did that, and it works: (development version)

PUBLIC SUB Main()

  DIM hProcess AS Process

  'hProcess = EXEC ["ls", "-laR", "/"]
  hProcess = SHELL "ls -laR /" FOR READ

  WAIT 2

  PRINT "*************** KILL"
  hProcess.Kill

  WAIT 5

END

PUBLIC SUB Process_Read()

  DIM sStr AS String

  READ #LAST, sStr, Lof(LAST)
  PRINT sStr;

END

The shell and the 'ls' command run during 2 seconds, and then they are stopped 
by the Kill method.

Tell me if it works with your 'cat /dev/video...'

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list