diff options
author | Yabin Cui <yabinc@google.com> | 2023-03-22 19:16:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-03-22 19:16:11 +0000 |
commit | ed03f660405875d41b971f0b1ed88040294404a2 (patch) | |
tree | 6ed14c49cf7f145c345440f1b34963bb705a6483 /simpleperf | |
parent | c4f97cd5836d0c59d86c111e082e2368fcea8673 (diff) | |
parent | 1fa6678273aacb98cc9d217f7af1249edec4d809 (diff) | |
download | extras-ed03f660405875d41b971f0b1ed88040294404a2.tar.gz |
Merge "simpleperf: Use mv command as a fallback to rename."
Diffstat (limited to 'simpleperf')
-rw-r--r-- | simpleperf/cmd_record.cpp | 11 |
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; } } |