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
gugelfrei
Jeff Sharkey 8 years ago committed by Jeff Sharkey
parent 0fe14bdd1c
commit fce701b5f1

@ -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 @@ static status_t execRm(const std::string& path, int startProgress, int stepProgr
return OK;
}
#if EXEC_BLOCKING
return ForkExecvp(cmd);
#else
pid_t pid = ForkExecvpAsync(cmd);
if (pid == -1) return -1;
@ -113,6 +118,7 @@ static status_t execRm(const std::string& path, int startProgress, int stepProgr
((deltaFreeBytes * stepProgress) / expectedBytes), 0, stepProgress));
}
return -1;
#endif
}
static status_t execCp(const std::string& fromPath, const std::string& toPath,
@ -134,6 +140,9 @@ static status_t execCp(const std::string& fromPath, const std::string& toPath,
}
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 @@ static status_t execCp(const std::string& fromPath, const std::string& toPath,
((deltaFreeBytes * stepProgress) / expectedBytes), 0, stepProgress));
}
return -1;
#endif
}
static void bringOffline(const std::shared_ptr<VolumeBase>& vol) {

Loading…
Cancel
Save