From 22435135d872c882f2644e36160cd8197e03089c Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Sun, 17 Jul 2022 18:59:40 -0700 Subject: [PATCH] Add stub for shell --- README.md | 4 ++-- shell.go | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 shell.go diff --git a/README.md b/README.md index 1c02bf9..e626d47 100644 --- a/README.md +++ b/README.md @@ -77,11 +77,11 @@ func main() { log.Fatalf("unable to connect to device %s: %v", opts.Address, err) } defer dev.Disconnect() - stdout, stderr, err := dev.Shell("ls") + stdout, stderr, errCode, err := dev.Shell("ls") if err != nil { log.Fatalf("unable to shell into device %s: %v", opts.Address, err) } - log.Printf("Stdout: %s\nStderr: %s\n", stdout, stderr) + log.Printf("Stdout: %s\nStderr: %s\n, ErrCode: %d", stdout, stderr, errCode) } ``` diff --git a/shell.go b/shell.go new file mode 100644 index 0000000..0a674e3 --- /dev/null +++ b/shell.go @@ -0,0 +1,15 @@ +package adb + +import ( + "context" +) + +// Shell allows you to run an arbitrary shell command against a device. +// +// This function is useful if you need to run an obscure shell command or if +// you require functionality not provided by the exposed functions here. +// Instead of using Shell, please consider submitting a PR with the functionality +// you require. +func (d Device) Shell(ctx context.Context, command string) (stdout string, stderr string, ErrCode int, err error) { + return "", "", 1, nil +}