about summary refs log tree commit diff
path: root/src/r2.go
blob: 6ecd24bd4156b6c99dcceafa265034034402ca5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}