Browse Source

* Patch from #18617 Forkevent from Seth Grover.

git-svn-id: trunk@16822 -
marco 14 years ago
parent
commit
a14b0d020e
2 changed files with 15 additions and 0 deletions
  1. 13 0
      packages/fcl-process/src/process.pp
  2. 2 0
      packages/fcl-process/src/unix/process.inc

+ 13 - 0
packages/fcl-process/src/process.pp

@@ -41,6 +41,10 @@ Type
 
 
 
 
 Type
 Type
+  {$ifdef UNIX}
+  TProcessForkEvent = procedure;
+  {$endif UNIX}
+
   TProcess = Class (TComponent)
   TProcess = Class (TComponent)
   Private
   Private
     FProcessOptions : TProcessOptions;
     FProcessOptions : TProcessOptions;
@@ -58,6 +62,9 @@ Type
     FEnvironment : Tstrings;
     FEnvironment : Tstrings;
     FShowWindow : TShowWindowOptions;
     FShowWindow : TShowWindowOptions;
     FInherithandles : Boolean;
     FInherithandles : Boolean;
+    {$ifdef UNIX}
+    FForkEvent : TProcessForkEvent;
+    {$endif UNIX}
     FProcessPriority : TProcessPriority;
     FProcessPriority : TProcessPriority;
     dwXCountchars,
     dwXCountchars,
     dwXSize,
     dwXSize,
@@ -113,6 +120,9 @@ Type
     Property Stderr : TinputPipeStream  Read FStderrStream;
     Property Stderr : TinputPipeStream  Read FStderrStream;
     Property ExitStatus : Integer Read GetExitStatus;
     Property ExitStatus : Integer Read GetExitStatus;
     Property InheritHandles : Boolean Read FInheritHandles Write FInheritHandles;
     Property InheritHandles : Boolean Read FInheritHandles Write FInheritHandles;
+    {$ifdef UNIX}
+    property OnForkEvent : TProcessForkEvent Read FForkEvent Write FForkEvent;
+    {$endif UNIX}
   Published
   Published
     Property Active : Boolean Read GetRunning Write SetActive;
     Property Active : Boolean Read GetRunning Write SetActive;
     Property ApplicationName : String Read FApplicationName Write SetApplicationName;
     Property ApplicationName : String Read FApplicationName Write SetApplicationName;
@@ -163,6 +173,9 @@ begin
   FProcessPriority:=ppNormal;
   FProcessPriority:=ppNormal;
   FShowWindow:=swoNone;
   FShowWindow:=swoNone;
   FInheritHandles:=True;
   FInheritHandles:=True;
+  {$ifdef UNIX}
+  FForkEvent:=nil;
+  {$endif UNIX}
   FEnvironment:=TStringList.Create;
   FEnvironment:=TStringList.Create;
 end;
 end;
 
 

+ 2 - 0
packages/fcl-process/src/unix/process.inc

@@ -360,6 +360,8 @@ begin
                 safefpdup2(fd,1);
                 safefpdup2(fd,1);
                 safefpdup2(fd,2);
                 safefpdup2(fd,2);
               end;
               end;
+            if Assigned(FForkEvent) then
+              FForkEvent;
             if (poRunSuspended in Options) then
             if (poRunSuspended in Options) then
               sigraise(SIGSTOP);
               sigraise(SIGSTOP);
             if FEnv<>Nil then
             if FEnv<>Nil then