diff --git a/src/app/Fake.Core.Process/CreateProcess.fs b/src/app/Fake.Core.Process/CreateProcess.fs index c5545b36134..ecdda7fa296 100644 --- a/src/app/Fake.Core.Process/CreateProcess.fs +++ b/src/app/Fake.Core.Process/CreateProcess.fs @@ -52,6 +52,12 @@ type CreateProcess<'TRes> = member x.WorkingDirectory = x.InternalWorkingDirectory member x.Environment = x.InternalEnvironment +/// Some information regaring the started process +type StartedProcessInfo = + internal { + InternalProcess : Process + } + member x.Process = x.InternalProcess /// Module for creating and modifying CreateProcess<'TRes> instances. /// You can manage: @@ -333,7 +339,7 @@ module CreateProcess = (fun state p -> ()) (fun prev state exitCode -> prev) (fun _ -> f ()) - /// Execute the given function right after the process is started. + /// Execute the given function right after the process is started. let addOnStarted f (c:CreateProcess<_>) = c |> appendSimpleFuncs @@ -341,6 +347,16 @@ module CreateProcess = (fun state p -> f ()) (fun prev state exitCode -> prev) ignore + + /// Execute the given function right after the process is started. + /// PID for process can be obtained from p parameter (p.Process.Id). + let addOnStartedEx (f:StartedProcessInfo -> _) (c:CreateProcess<_>) = + c + |> appendSimpleFuncs + ignore + (fun state p -> f { InternalProcess = p }) + (fun prev state exitCode -> prev) + ignore /// Sets the given environment variables let withEnvironment (env: (string * string) list) (c:CreateProcess<_>)=