From 8334f68f8e3ebf9bec6b342c2a9cf9359a94c1dd Mon Sep 17 00:00:00 2001 From: maciej-izak Date: Mon, 13 Jan 2020 11:53:47 +0100 Subject: [PATCH 1/4] Pass instance of Diagnostics.Process for created process for function used in addOnStarted --- src/app/Fake.Core.Process/CreateProcess.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/Fake.Core.Process/CreateProcess.fs b/src/app/Fake.Core.Process/CreateProcess.fs index 142ae97857d..4b1432a47f4 100644 --- a/src/app/Fake.Core.Process/CreateProcess.fs +++ b/src/app/Fake.Core.Process/CreateProcess.fs @@ -333,12 +333,13 @@ 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. + /// PID for process can be obtained from p parameter (p.Id). let addOnStarted f (c:CreateProcess<_>) = c |> appendSimpleFuncs ignore - (fun state p -> f ()) + (fun state p -> f (p)) (fun prev state exitCode -> prev) ignore From f17c4f67aee01c1350b852658c14abc83d12ea51 Mon Sep 17 00:00:00 2001 From: maciej-izak Date: Tue, 14 Jan 2020 12:23:46 +0100 Subject: [PATCH 2/4] * Introduce new addOnStartedEx with simple record StartedProcessInfo which can be extended in the future * rollback changes for addOnStarted --- src/app/Fake.Core.Process/CreateProcess.fs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/Fake.Core.Process/CreateProcess.fs b/src/app/Fake.Core.Process/CreateProcess.fs index 4b1432a47f4..863a2be63ff 100644 --- a/src/app/Fake.Core.Process/CreateProcess.fs +++ b/src/app/Fake.Core.Process/CreateProcess.fs @@ -334,12 +334,23 @@ module CreateProcess = (fun prev state exitCode -> prev) (fun _ -> f ()) /// Execute the given function right after the process is started. - /// PID for process can be obtained from p parameter (p.Id). let addOnStarted f (c:CreateProcess<_>) = c |> appendSimpleFuncs ignore - (fun state p -> f (p)) + (fun state p -> f ()) + (fun prev state exitCode -> prev) + ignore + + type StartedProcessInfo = { Process : Process } + + /// 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 (c:CreateProcess<_>) = + c + |> appendSimpleFuncs + ignore + (fun state p -> f { Process = p }) (fun prev state exitCode -> prev) ignore From 436de8486855b33652a27c621739f5a1b20a9618 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Tue, 14 Jan 2020 14:55:49 +0100 Subject: [PATCH 3/4] Move type outside the module and make contructor internal --- src/app/Fake.Core.Process/CreateProcess.fs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/Fake.Core.Process/CreateProcess.fs b/src/app/Fake.Core.Process/CreateProcess.fs index 863a2be63ff..4b260c1850d 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: @@ -341,12 +347,10 @@ module CreateProcess = (fun state p -> f ()) (fun prev state exitCode -> prev) ignore - - type StartedProcessInfo = { Process : Process } /// 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 (c:CreateProcess<_>) = + let addOnStartedEx (f:StartedProcessInfo -> _) (c:CreateProcess<_>) = c |> appendSimpleFuncs ignore From 54f4db61ef71a1eeca6b9cd4a9e33db78e7be82b Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Tue, 14 Jan 2020 17:36:57 +0100 Subject: [PATCH 4/4] It's `InternalProcess` now --- src/app/Fake.Core.Process/CreateProcess.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Fake.Core.Process/CreateProcess.fs b/src/app/Fake.Core.Process/CreateProcess.fs index 4b260c1850d..e2f2a8bb106 100644 --- a/src/app/Fake.Core.Process/CreateProcess.fs +++ b/src/app/Fake.Core.Process/CreateProcess.fs @@ -354,7 +354,7 @@ module CreateProcess = c |> appendSimpleFuncs ignore - (fun state p -> f { Process = p }) + (fun state p -> f { InternalProcess = p }) (fun prev state exitCode -> prev) ignore