aboutsummaryrefslogtreecommitdiff
path: root/tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go')
-rw-r--r--tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go b/tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go
new file mode 100644
index 0000000..ea1208a
--- /dev/null
+++ b/tools/glue/vendor/github.com/ThomasRooney/gexpect/examples/python.go
@@ -0,0 +1,22 @@
+package main
+
+import "github.com/ThomasRooney/gexpect"
+import "fmt"
+
+func main() {
+ fmt.Printf("Starting python.. \n")
+ child, err := gexpect.Spawn("python")
+ if err != nil {
+ panic(err)
+ }
+ fmt.Printf("Expecting >>>.. \n")
+ child.Expect(">>>")
+ fmt.Printf("print 'Hello World'..\n")
+ child.SendLine("print 'Hello World'")
+ child.Expect(">>>")
+
+ fmt.Printf("Interacting.. \n")
+ child.Interact()
+ fmt.Printf("Done \n")
+ child.Close()
+}