summaryrefslogtreecommitdiff
path: root/simpleperf
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2023-03-22 19:16:11 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-03-22 19:16:11 +0000
commited03f660405875d41b971f0b1ed88040294404a2 (patch)
tree6ed14c49cf7f145c345440f1b34963bb705a6483 /simpleperf
parentc4f97cd5836d0c59d86c111e082e2368fcea8673 (diff)
parent1fa6678273aacb98cc9d217f7af1249edec4d809 (diff)
downloadextras-ed03f660405875d41b971f0b1ed88040294404a2.tar.gz
Merge "simpleperf: Use mv command as a fallback to rename."
Diffstat (limited to 'simpleperf')
-rw-r--r--simpleperf/cmd_record.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index a5f129d0..82cc2b06 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -1764,11 +1764,12 @@ std::unique_ptr<RecordFileReader> RecordCommand::MoveRecordFile(const std::strin
return nullptr;
}
record_file_writer_.reset();
- {
- std::error_code ec;
- std::filesystem::rename(record_filename_, old_filename, ec);
- if (ec) {
- LOG(ERROR) << "Failed to rename: " << ec.message();
+ std::error_code ec;
+ std::filesystem::rename(record_filename_, old_filename, ec);
+ if (ec) {
+ LOG(DEBUG) << "Failed to rename: " << ec.message();
+ // rename() fails on x86 emulator for Android N. So add a fallback to mv command.
+ if (!Workload::RunCmd({"mv", record_filename_, old_filename})) {
return nullptr;
}
}