lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhern...@apache.org
Subject [2/2] git commit: updating to ExecProcessAndReturnMessages
Date Fri, 18 Jul 2014 06:35:53 GMT
updating to ExecProcessAndReturnMessages


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/dbcfacc5
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/dbcfacc5
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/dbcfacc5

Branch: refs/heads/pcl
Commit: dbcfacc575ad0d87797fe2b5dae811fd2e3b48d9
Parents: bd8eb2e
Author: Michael Herndon <mherndon@michaelherndon.com>
Authored: Fri Jul 18 02:34:37 2014 -0400
Committer: Michael Herndon <mherndon@michaelherndon.com>
Committed: Fri Jul 18 02:34:37 2014 -0400

----------------------------------------------------------------------
 build.fsx | 62 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/dbcfacc5/build.fsx
----------------------------------------------------------------------
diff --git a/build.fsx b/build.fsx
index 46995d0..3603a47 100644
--- a/build.fsx
+++ b/build.fsx
@@ -1,5 +1,5 @@
 #r @"packages/FAKE/tools/FakeLib.dll"
-
+open System
 open Fake
 
 let buildDir = "./build"
@@ -7,22 +7,8 @@ let buildDir = "./build"
 // from SO http://stackoverflow.com/questions/3065409/starting-a-process-synchronously-and-streaming-the-output
 type ProcessResult = { exitCode : int; stdout : string; stderr : string }
 
-let executeProcess (exe, cmdline, wd) =
-    let psi = new System.Diagnostics.ProcessStartInfo(exe,cmdline) 
-    psi.UseShellExecute <- false
-    psi.RedirectStandardOutput <- true
-    psi.RedirectStandardError <- true
-    psi.CreateNoWindow <- true
-    if wd <> null then psi.WorkingDirectory <- wd    
-    let p = System.Diagnostics.Process.Start(psi) 
-    let output = new System.Text.StringBuilder()
-    let error = new System.Text.StringBuilder()
-    p.OutputDataReceived.Add(fun args -> output.Append(args.Data) |> ignore)
-    p.ErrorDataReceived.Add(fun args -> error.Append(args.Data) |> ignore)
-    p.BeginErrorReadLine()
-    p.BeginOutputReadLine()
-    p.WaitForExit()
-    { exitCode = p.ExitCode; stdout = output.ToString(); stderr = error.ToString() }
+
+    
 
 Target "Clean" (fun _ -> 
     trace "Clean"
@@ -33,25 +19,47 @@ Target "Build:Core" (fun _ ->
     //let errorCode = Shell.Exec "cmd","/c k build ./src/Lucene.Net.Core"
     //do something with the error code
     //()
-    let result = executeProcess("cmd", "/c k build ./src/Lucene.Net.Core/", null)
-    trace result.stdout;
+    let out = (ExecProcessAndReturnMessages(fun info ->
+                info.FileName <- "cmd"
+                info.Arguments <- "/c k build ./src/Lucene.Net.Core/"
+            ) (TimeSpan.FromMinutes 5.0))
+    let code = sprintf "%i" out.ExitCode
+    trace code
 )
 
 Target "Build:TestFramework" (fun _ ->
-    let result = executeProcess("cmd", "/c k build ./test/Lucene.Net.TestFramework/", null)
-    trace result.stdout;
+
+    let out =  (ExecProcessAndReturnMessages(fun info ->
+                info.FileName <- "cmd"
+                info.Arguments <- "/c k build ./test/Lucene.Net.TestFramework/"
+            ) (TimeSpan.FromMinutes 5.0))
+
+   
+    let code = sprintf "%i" out.ExitCode
+    trace code
 )
 
 Target "Build:Core:Tests" (fun _ ->
-    let result = executeProcess("cmd", "/c k build ./test/Lucene.Net.Core.Tests/", null)
-    trace result.stdout;
+
+    let out = (ExecProcessAndReturnMessages(fun info ->
+                info.FileName <- "cmd"
+                info.Arguments <- "/c k build ./test/Lucene.Net.Core.Tests/"
+            ) (TimeSpan.FromMinutes 5.0))
+    let code = sprintf "%i" out.ExitCode
+    trace code
 )
 
 Target "Test:Core" (fun _ ->
-    let result = executeProcess("cmd", "/c k test", "./test/Lucene.Net.Core.Tests/")
-    trace ""
-    trace result.stdout
-    trace result.stderr
+    let out = (ExecProcessAndReturnMessages(fun info ->
+                info.FileName <- "cmd"
+                info.Arguments <- "/c k test"
+                info.WorkingDirectory <- "./test/Lucene.Net.Core.Tests/"
+            ) (TimeSpan.FromMinutes 5.0))
+   
+    let code = sprintf "%i" out.ExitCode
+    trace code
+    //trace result.stdout
+    //trace result.stderr
 )
 
 Target "Default" (fun _ ->


Mime
View raw message