From a8b1b87f7b33ab3d37fc3aed276d356d61631367 Mon Sep 17 00:00:00 2001 From: Jose Garcia Date: Thu, 24 Jun 2021 20:44:16 -0400 Subject: [PATCH] Start of RPC implementation, need to figure out format --- example/main.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/example/main.go b/example/main.go index 79ab53377..bbf540d7c 100644 --- a/example/main.go +++ b/example/main.go @@ -10,8 +10,8 @@ import ( func main() { liveShare, err := liveshare.New( - liveshare.WithWorkspaceID("..."), - liveshare.WithToken("..."), + liveshare.WithWorkspaceID(""), + liveshare.WithToken(""), ) if err != nil { log.Fatal(fmt.Errorf("error creating liveshare: %v", err)) @@ -20,4 +20,17 @@ func main() { if err := liveShare.Connect(context.Background()); err != nil { log.Fatal(fmt.Errorf("error connecting to liveshare: %v", err)) } + + terminal := liveShare.NewTerminal() + + cmd := terminal.NewCommand( + "/home/codespace/workspace", + "docker ps -aq --filter label=Type=codespaces --filter status=running", + ) + output, err := cmd.Run(context.Background()) + if err != nil { + log.Fatal(fmt.Errorf("error starting ssh server with liveshare: %v", err)) + } + + fmt.Println(string(output)) }