Expose adb execution with redirection
Expose the redirection feature to the adb API.
This commit is contained in:
parent
eaf4afaad9
commit
96b18dabaa
2 changed files with 16 additions and 2 deletions
|
@ -109,7 +109,9 @@ show_adb_err_msg(enum process_result err, const char *const argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
process_t
|
process_t
|
||||||
adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
|
adb_execute_redirect(const char *serial, const char *const adb_cmd[],
|
||||||
|
size_t len, pipe_t *pipe_stdin, pipe_t *pipe_stdout,
|
||||||
|
pipe_t *pipe_stderr) {
|
||||||
int i;
|
int i;
|
||||||
process_t process;
|
process_t process;
|
||||||
|
|
||||||
|
@ -129,7 +131,9 @@ adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
|
||||||
|
|
||||||
memcpy(&argv[i], adb_cmd, len * sizeof(const char *));
|
memcpy(&argv[i], adb_cmd, len * sizeof(const char *));
|
||||||
argv[len + i] = NULL;
|
argv[len + i] = NULL;
|
||||||
enum process_result r = process_execute(argv, &process);
|
enum process_result r =
|
||||||
|
process_execute_redirect(argv, &process, pipe_stdin, pipe_stdout,
|
||||||
|
pipe_stderr);
|
||||||
if (r != PROCESS_SUCCESS) {
|
if (r != PROCESS_SUCCESS) {
|
||||||
show_adb_err_msg(r, argv);
|
show_adb_err_msg(r, argv);
|
||||||
process = PROCESS_NONE;
|
process = PROCESS_NONE;
|
||||||
|
@ -139,6 +143,11 @@ adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
|
||||||
return process;
|
return process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
|
||||||
|
return adb_execute_redirect(serial, adb_cmd, len, NULL, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
process_t
|
process_t
|
||||||
adb_forward(const char *serial, uint16_t local_port,
|
adb_forward(const char *serial, uint16_t local_port,
|
||||||
const char *device_socket_name) {
|
const char *device_socket_name) {
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
process_t
|
process_t
|
||||||
adb_execute(const char *serial, const char *const adb_cmd[], size_t len);
|
adb_execute(const char *serial, const char *const adb_cmd[], size_t len);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_execute_redirect(const char *serial, const char *const adb_cmd[],
|
||||||
|
size_t len, pipe_t *pipe_stdin, pipe_t *pipe_stdout,
|
||||||
|
pipe_t *pipe_stderr);
|
||||||
|
|
||||||
process_t
|
process_t
|
||||||
adb_forward(const char *serial, uint16_t local_port,
|
adb_forward(const char *serial, uint16_t local_port,
|
||||||
const char *device_socket_name);
|
const char *device_socket_name);
|
||||||
|
|
Loading…
Reference in a new issue