in reply to Re: Changing process name
in thread Changing process name

The changing of process names should work under Linux and/or 
Win32, cause these are my target OS. I thought that it may not
be possible to do such a change, but I was just curious. 
Futhermore I use wxPerl (wxWidgets) to start subprocesses, so 
I can't use exec or system.

Replies are listed 'Best First'.
Re^3: Changing process name
by BrowserUk (Patriarch) on Aug 26, 2006 at 11:51 UTC
    I use wxPerl (wxWidgets) to start subprocesses, so I can't use exec or system.

    Then how do you "start subprocesses"?

    The probablility is that under Win32, you could system 1, 'perl.exe script.pl'; as this does an asynchronous spawn. Ie. It returns immediately and so does not upset GUI message loops.

    Similarly, you could probably use system 'perl script &'; under Linux to achieve the same end.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Looks like this:
      my $szPerlExe = $this->{$this->{choPerlExecutable}->GetStringSelection +()}; my $szShell = $this->{stcShell}->GetText(); $szShell =~ s/"/\\"/g; my $szCommand = $szPerlExe.' -e '.'"'.$szShell.'"'; $this->{wProcessId} = Wx::NewId(); $this->{hProcess} = Wx::Process->new($this, $this->{wProcessId}); $this->{hProcess}->Redirect(); $this->{hProcess}->CloseOutput(); my $wProcessPid = Wx::ExecuteCommand($szCommand, wxEXEC_ASYNC|wxEXEC_N +OHIDE, $this->{hProcess}); $this->{wProcessPID}->{$wProcessPid} = $szTimeStamp; $this->{tmrProcessRunning} = Wx::Timer->new($this, $this->{wProcessId} +); $this->{tmrProcessRunning}->Start(500); EVT_TIMER($this, $this->{wProcessId}, \&ProcessRunning_OnTimer); EVT_END_PROCESS($this, $this->{wProcessId}, \&ProcessEnded);
      So I need a way to change the name of a process from within the executed script. I also use this kind of execution for system commands and scripts (without perl -e)
        I need a way to change the name of a process from within the executed script

        Well. There is no way of doing this on Win32 that I am aware of, and I've looked pretty hard. As noted elsewhere, this is "by design", as executables that can change their apparent name is a security hole.

        WxPerl is outside of my experience and sufficiently different from similar stuff (Tk) that I doubt I can help.

        One thought that does cross my mind is: How are the commands run? Does a new (console) window appear or are they run strictly in the background?

        If they run in a window, would changing the title of the window be sufficient to differentiate them?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.