Hi list.

Which function to use in Linux (if any) to get the process ID of a
running process which is not mine. GetProcessID retrieves my own process
ID.
I'm using OpenProcess in Win

Antonio.

This time it is not a question but a solution to a problem which was quite boring.

Using the TProcess component to launch antother task, I ran in trouble when dealing with piped commands like 'ps -s | grep something'
Got the solution:

  with TProcess.Create(nil) do try
    CommandLine := CmdLine.Text;
    Options := Options + [poWaitOnExit, poUsePipes, poStderrToOutPut];
    Execute;
    Memo1.Lines.LoadFromStream(Output);
  Finally
    Free
  End

CmdLine.Text := '/bin/sh -c ''ps -s | grep something'' '
THis works fine whatever the sh could be (I use bash)

Antonio.
        

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to