[chronojump] Finally fix R race condition on win32
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] Finally fix R race condition on win32
- Date: Tue, 8 Sep 2009 11:59:41 +0000 (UTC)
commit dde0567f7883fed6accafa8da8cf74edab31dc52
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue Sep 8 13:42:17 2009 +0200
Finally fix R race condition on win32
src/stats/main.cs | 2 +-
src/util.cs | 10 +++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/stats/main.cs b/src/stats/main.cs
index c0bd5dc..1d0c491 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1251,7 +1251,7 @@ public class Stat
//fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
- string rScript = System.IO.Path.Combine(Path.GetTempPath(), Constants.FileNameRScript);
+ string rScript = System.IO.Path.Combine(Path.GetTempPath(), graphNum+Constants.FileNameRScript);
TextWriter writer = File.CreateText(rScript);
writer.Write(rString);
writer.Flush();
diff --git a/src/util.cs b/src/util.cs
index 6d27907..7da2c09 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -730,11 +730,14 @@ public class Util
public static void RunRScript(string rScript){
ProcessStartInfo pinfo;
- Process r;
+ Process r;
string rBin="R";
//If output file is not given, R will try to write in the running folder
//in which we may haven't got permissions
- string outputFile = System.IO.Path.Combine(Path.GetTempPath(), Constants.FileNameRScript+".Rout");
+ string outputFile = rScript+".Rout";
+
+ if (File.Exists(outputFile))
+ File.Delete(outputFile);
if (IsWindows())
rBin=System.IO.Path.Combine(GetPrefixDir(), "bin/R.exe");
@@ -748,7 +751,8 @@ public class Util
r = new Process();
r.StartInfo = pinfo;
r.Start();
- r.WaitForExit();
+ r.WaitForExit();
+ while (!File.Exists(outputFile));
}
/*
* currently not used, we copy the assemblies now
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]