fastdeploy: fix tests.
Actually log results of adb commands, so we can see why this fails.
Fix the asan-detected use of a value from a reused part of the stack.
Test: atest FastDeployTest on Linux (with an asan adb)
Change-Id: I4d2bbae62a301e16065d604a2c9918077489cafb
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp
index bdc9e56..5fa0edb 100644
--- a/adb/client/fastdeploy.cpp
+++ b/adb/client/fastdeploy.cpp
@@ -101,17 +101,12 @@
static void push_to_device(const void* data, size_t byte_count, const char* dst, bool sync) {
std::vector<const char*> srcs;
- {
- TemporaryFile temp;
- android::base::WriteFully(temp.fd, data, byte_count);
- srcs.push_back(temp.path);
-
- // On Windows, the file needs to be flushed before pushing to device.
- // closing the file flushes its content, but we still need to remove it after push.
- // FileDeleter does exactly that.
- temp.DoNotRemove();
- }
- FileDeleter temp_deleter(srcs.back());
+ TemporaryFile tf;
+ android::base::WriteFully(tf.fd, data, byte_count);
+ srcs.push_back(tf.path);
+ // On Windows, the file needs to be flushed before pushing to device,
+ // but can't be removed until after the push.
+ unix_close(tf.release());
if (!do_sync_push(srcs, dst, sync)) {
error_exit("Failed to push fastdeploy agent to device.");