Catch pid for a process that created

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mav

    Catch pid for a process that created

    Hi,
    I am writing a perl script on windows that try to get the pid for a
    program that created another processes.

    ......

    @args = ("\"$devPath\\d evenv.com\" ..\\Solution\\M y.sln /build
    Debug");
    $pid = open my $proc, "@args |";
    ....


    the $pid will give me the pid for devenv.com; However, the devenv.com
    actually created another process name devenv.exe, is that a way I can
    get that pid.

    Thanks,
    Mav
  • lxrocks

    #2
    Re: Catch pid for a process that created

    Mav wrote:[color=blue]
    > Hi,
    > I am writing a perl script on windows that try to get the pid for a
    > program that created another processes.
    >
    > .....
    >
    > @args = ("\"$devPath\\d evenv.com\" ..\\Solution\\M y.sln /build
    > Debug");
    > $pid = open my $proc, "@args |";
    > ...
    >
    >
    > the $pid will give me the pid for devenv.com; However, the devenv.com
    > actually created another process name devenv.exe, is that a way I can
    > get that pid.
    >
    > Thanks,
    > Mav[/color]
    Don't know much about windows, but try the Win32::ToolHelp module.
    It can provide process information.


    Comment

    • Mav

      #3
      Re: Catch pid for a process that created

      lxrocks <lxrocks@hotmai l.com> wrote in message news:<kMFSc.531 13$K53.10738@ne ws-server.bigpond. net.au>...[color=blue]
      > Mav wrote:[color=green]
      > > Hi,
      > > I am writing a perl script on windows that try to get the pid for a
      > > program that created another processes.
      > >
      > > .....
      > >
      > > @args = ("\"$devPath\\d evenv.com\" ..\\Solution\\M y.sln /build
      > > Debug");
      > > $pid = open my $proc, "@args |";
      > > ...
      > >
      > >
      > > the $pid will give me the pid for devenv.com; However, the devenv.com
      > > actually created another process name devenv.exe, is that a way I can
      > > get that pid.
      > >
      > > Thanks,
      > > Mav[/color]
      > Don't know much about windows, but try the Win32::ToolHelp module.
      > It can provide process information.
      >
      > http://search.cpan.org/~prantl/Win32....2/ToolHelp.pm[/color]

      That will give me the process devenv.com, but I still cannot get the
      devenv.com. The problem I have is when I start my script that will
      call devenv.com, however, the devenv.com will call devenv.exe, If I
      using Ctrl-C to
      stop (or install my SIG handler), I can only kill devenv.com, which
      will leave the devenv.exe still running.

      Any suggestion?

      Comment

      Working...