diff --git a/dataflow/src/patches/Adder.cs b/dataflow/src/patches/Adder.cs index e801492..8b1a2be 100644 --- a/dataflow/src/patches/Adder.cs +++ b/dataflow/src/patches/Adder.cs @@ -13,10 +13,10 @@ namespace Dataflow.Patches { public class Adder { [Inlet(Name="Left")] public Inlet left { get; set; } - + [Inlet(Name="Right")] public Inlet right { get; set; } - + [Outlet(Name="Result")] public Outlet result { get; set; } diff --git a/dataflow/src/patches/Exec.cs b/dataflow/src/patches/Exec.cs index 3887b8a..72a164b 100644 --- a/dataflow/src/patches/Exec.cs +++ b/dataflow/src/patches/Exec.cs @@ -32,7 +32,7 @@ public class Exec { [Outlet(Name="Status")] public Outlet Status { get; set; } - + public void Init(IPatchContainer container) { Args = container.AddInlet("Arguments"); Path = container.AddInlet("Path"); @@ -41,7 +41,7 @@ public void Init(IPatchContainer container) { StdOut = container.AddOutlet("Output"); StdErr = container.AddOutlet("Error"); Status = container.AddOutlet("Status"); - + } public void Execute() { @@ -55,21 +55,21 @@ public void Execute() { info.RedirectStandardError = true; try { Process proc = Process.Start(info); - + proc.StandardInput.Write(StdIn.Value); proc.StandardInput.Close(); - + StdErr.Value = proc.StandardError.ReadToEnd(); StdOut.Value = proc.StandardOutput.ReadToEnd(); - + proc.WaitForExit(); - Status.Value = proc.ExitCode; + Status.Value = proc.ExitCode; } catch { Status.Value = -1; } } - + } } diff --git a/dataflow/test/patches/ExecTest.cs b/dataflow/test/patches/ExecTest.cs index 931c062..4dde82d 100644 --- a/dataflow/test/patches/ExecTest.cs +++ b/dataflow/test/patches/ExecTest.cs @@ -64,7 +64,7 @@ protected Outlet ErrorOutlet() { protected void Run() { Exec exec = new Exec(); exec.Init(mockPatchContainer); - + exec.Execute(); } @@ -78,22 +78,22 @@ public void ShouldSetStatusToOneWhenExecutableNotFound() { Outlet error = ErrorOutlet(); Run(); - + Assert.AreEqual(-1, status.Value); } - + [Test()] public void ShouldExecuteShellCommandGracefully() { PathIs("/usr/bin/true"); ArgumentsAre(""); InputIs(""); - + Outlet status = StatusOutlet(); Outlet output = OutputOutlet(); Outlet error = ErrorOutlet(); Run(); - + Assert.AreEqual(0, status.Value); } @@ -102,28 +102,28 @@ public void ShouldExecuteShellCommandWithErrorExitCodeGracefully() { PathIs("/usr/bin/false"); ArgumentsAre(""); InputIs(""); - + Outlet status = StatusOutlet(); Outlet output = OutputOutlet(); Outlet error = ErrorOutlet(); Run(); - + Assert.AreEqual(1, status.Value); } - + [Test()] public void ShouldExecuteShellCommandWithOutputToStdOut() { PathIs("/bin/echo"); ArgumentsAre("hello"); InputIs(""); - + Outlet status = StatusOutlet(); Outlet output = OutputOutlet(); Outlet error = ErrorOutlet(); Run(); - + Assert.AreEqual(0, status.Value); Assert.AreEqual("hello\n", output.Value); } @@ -133,17 +133,17 @@ public void ShouldExecuteShellCommandWithInputFromStdIn() { PathIs("/bin/cat"); ArgumentsAre(""); InputIs("hello"); - + Outlet status = StatusOutlet(); Outlet output = OutputOutlet(); Outlet error = ErrorOutlet(); Run(); - + Assert.AreEqual(0, status.Value); Assert.AreEqual("hello", output.Value); } - - + + } } \ No newline at end of file diff --git a/util/format.sh b/util/format.sh index 6e7cae8..df98e86 100755 --- a/util/format.sh +++ b/util/format.sh @@ -4,7 +4,7 @@ # # See AUTHORS and LICENSE for details. -if [ `which astyle` ]; then +if [ `which astyle` ]; then find . -name *.cs | xargs astyle --mode=cs -U -l -p --style=kr exit $?