about summary refs log tree commit diff
path: root/src/r2.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/r2.go')
-rw-r--r--src/r2.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/r2.go b/src/r2.go
new file mode 100644
index 0000000..6ecd24b
--- /dev/null
+++ b/src/r2.go
@@ -0,0 +1,24 @@
+package main
+
+import (
+	"log"
+
+	"github.com/radareorg/r2pipe-go"
+)
+
+func r2cmd(r2p *r2pipe.Pipe, input string) (string, error) {
+
+	log.Println("---")
+	log.Printf("> %s\n", input)
+	log.Println("---")
+
+	// send a command
+	buf1, err := r2p.Cmd(input)
+	if err != nil {
+		log.Println(err)
+		return "", err
+	}
+
+	// return the result of the command as a string
+	return buf1, nil
+}