summaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
new file mode 100644
index 0000000..3b16914
--- /dev/null
+++ b/src/main.zig
@@ -0,0 +1,22 @@
+const std = @import("std");
+
+const ssh = @import("ssh.zig");
+
+pub fn main() anyerror!void {
+ var client = ssh.Client.init("localhost") catch unreachable;
+ const stdout = std.io.getStdOut();
+ client.run("pwd", stdout) catch unreachable;
+ client.run("who", stdout) catch unreachable;
+ client.deinit();
+}
+
+test "basic test" {
+ // this test requires you can ssh localhost without a password prompt
+ // (typically by having your ssh_agent running)
+ var client = ssh.Client.init("localhost") catch unreachable;
+ var buffer = std.ArrayList(u8).init(std.testing.allocator);
+ defer buffer.deinit();
+ client.run("echo test", buffer.writer()) catch unreachable;
+ try std.testing.expectEqualSlices(u8, buffer.items, "test\n");
+ client.deinit();
+}