execOut method
Executes a command on the device and returns the result.
If outputFile is provided, the raw (binary) stdout of the command is
written directly to that file on the host, replicating a shell
redirection such as adb ... exec-out screencap -p > file.png.
In that case the returned ProcessResult has an empty stdout, and its
ProcessResult.exitCode reflects the process exit code.
Do not include a > redirection inside command: it would be
interpreted by the device shell (not the host), not achieving the
intended result. Use outputFile instead.
Implementation
Future<ProcessResult> execOut(
String command, {
String? outputFile,
bool debug = false,
}) async {
final arguments = [..._connection.arguments, 'exec-out', command];
if (outputFile != null) {
final exitCode = await _bridge.executor.executeToFile(
arguments,
outputFile: outputFile,
debug: debug,
);
return ProcessResult(0, exitCode, '', '');
}
return await _bridge.executor.execute(arguments, debug: debug);
}