Blocking mode for debugging purposes.
The default non-blocking mode doesn't log stdout/err from the
commands exec'ed during a move.
Bug: 29923055
Change-Id: I9de3fe9bfcfa3c1d39a32ecc89dd765202460376
diff --git a/MoveTask.cpp b/MoveTask.cpp
index 0a60c4e..38cca04 100644
--- a/MoveTask.cpp
+++ b/MoveTask.cpp
@@ -29,6 +29,8 @@
#define CONSTRAIN(amount, low, high) ((amount) < (low) ? (low) : ((amount) > (high) ? (high) : (amount)))
+#define EXEC_BLOCKING 0
+
using android::base::StringPrintf;
namespace android {
@@ -93,6 +95,9 @@
return OK;
}
+#if EXEC_BLOCKING
+ return ForkExecvp(cmd);
+#else
pid_t pid = ForkExecvpAsync(cmd);
if (pid == -1) return -1;
@@ -113,6 +118,7 @@
((deltaFreeBytes * stepProgress) / expectedBytes), 0, stepProgress));
}
return -1;
+#endif
}
static status_t execCp(const std::string& fromPath, const std::string& toPath,
@@ -134,6 +140,9 @@
}
cmd.push_back(toPath.c_str());
+#if EXEC_BLOCKING
+ return ForkExecvp(cmd);
+#else
pid_t pid = ForkExecvpAsync(cmd);
if (pid == -1) return -1;
@@ -154,6 +163,7 @@
((deltaFreeBytes * stepProgress) / expectedBytes), 0, stepProgress));
}
return -1;
+#endif
}
static void bringOffline(const std::shared_ptr<VolumeBase>& vol) {