Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dataflow/src/patches/Adder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ namespace Dataflow.Patches {
public class Adder {
[Inlet(Name="Left")]
public Inlet<int> left { get; set; }

[Inlet(Name="Right")]
public Inlet<int> right { get; set; }

[Outlet(Name="Result")]
public Outlet<int> result { get; set; }

Expand Down
14 changes: 7 additions & 7 deletions dataflow/src/patches/Exec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Exec {

[Outlet(Name="Status")]
public Outlet<int> Status { get; set; }

public void Init(IPatchContainer container) {
Args = container.AddInlet<string>("Arguments");
Path = container.AddInlet<string>("Path");
Expand All @@ -41,7 +41,7 @@ public void Init(IPatchContainer container) {
StdOut = container.AddOutlet<string>("Output");
StdErr = container.AddOutlet<string>("Error");
Status = container.AddOutlet<int>("Status");

}

public void Execute() {
Expand All @@ -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;
}
}

}

}
28 changes: 14 additions & 14 deletions dataflow/test/patches/ExecTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected Outlet<string> ErrorOutlet() {
protected void Run() {
Exec exec = new Exec();
exec.Init(mockPatchContainer);

exec.Execute();
}

Expand All @@ -78,22 +78,22 @@ public void ShouldSetStatusToOneWhenExecutableNotFound() {
Outlet<string> error = ErrorOutlet();

Run();

Assert.AreEqual(-1, status.Value);
}

[Test()]
public void ShouldExecuteShellCommandGracefully() {
PathIs("/usr/bin/true");
ArgumentsAre("");
InputIs("");

Outlet<int> status = StatusOutlet();
Outlet<string> output = OutputOutlet();
Outlet<string> error = ErrorOutlet();

Run();

Assert.AreEqual(0, status.Value);
}

Expand All @@ -102,28 +102,28 @@ public void ShouldExecuteShellCommandWithErrorExitCodeGracefully() {
PathIs("/usr/bin/false");
ArgumentsAre("");
InputIs("");

Outlet<int> status = StatusOutlet();
Outlet<string> output = OutputOutlet();
Outlet<string> error = ErrorOutlet();

Run();

Assert.AreEqual(1, status.Value);
}

[Test()]
public void ShouldExecuteShellCommandWithOutputToStdOut() {
PathIs("/bin/echo");
ArgumentsAre("hello");
InputIs("");

Outlet<int> status = StatusOutlet();
Outlet<string> output = OutputOutlet();
Outlet<string> error = ErrorOutlet();

Run();

Assert.AreEqual(0, status.Value);
Assert.AreEqual("hello\n", output.Value);
}
Expand All @@ -133,17 +133,17 @@ public void ShouldExecuteShellCommandWithInputFromStdIn() {
PathIs("/bin/cat");
ArgumentsAre("");
InputIs("hello");

Outlet<int> status = StatusOutlet();
Outlet<string> output = OutputOutlet();
Outlet<string> error = ErrorOutlet();

Run();

Assert.AreEqual(0, status.Value);
Assert.AreEqual("hello", output.Value);
}


}
}
2 changes: 1 addition & 1 deletion util/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?

Expand Down