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

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.

Replies are listed 'Best First'.
Re^4: Changing process name
by Outaspace (Scribe) on Aug 26, 2006 at 12:57 UTC
    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.
        If I executed my App with perl and there is a console window 
        opened for it not. Maybe if I use wperl (which do not open a 
        console), then the executed script opens a new console window,
        but I'm not sure. 
        
        So it looks like I have to differentiate them by Process Id 
        and the timestamp, when they where executed. It isnt that kind of problem anyway, it would just be better if.
        
        Thanks anyway