Skip to content

Commit

Permalink
Fixes folder timestamps being updated before copying files into them (o…
Browse files Browse the repository at this point in the history
…pensearch-project#2964)

* When updating the timestamps were requested, scanCopy first set the times and then copied content into the destination folder. On certain platforms, copying files into a folder updates its "Last Access Time" and that overwrites the just set timestamps. This PR, makes sure the timestamps are set only after copying the content.

Signed-off-by: Miki <amoo_miki@yahoo.com>

Signed-off-by: Miki <amoo_miki@yahoo.com>
  • Loading branch information
AMoo-Miki authored and AlexRuiz7 committed Dec 14, 2022
1 parent ed33402 commit 00b44e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Temporary workaround for task-kill exceptions on Windows when it is passed a pid for a process that is already dead ([#2842](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2842))
- [Vis Builder] Fix empty workspace animation does not work in firefox ([#2853](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2853))
- Bumped `del` version to fix MacOS race condition ([#2847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2873))
- [Build] Fixed "Last Access Time" not being set by `scanCopy` on Windows ([#2964](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2964))

### 🚞 Infrastructure

Expand Down
8 changes: 4 additions & 4 deletions src/dev/build/lib/scan_copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ export async function scanCopy(options: Options) {
await copyFileAsync(record.absolute, record.absoluteDest, Fs.constants.COPYFILE_EXCL);
}

if (time) {
await utimesAsync(record.absoluteDest, time, time);
}

if (record.isDirectory) {
await copyChildren(record);
}

if (time) {
await utimesAsync(record.absoluteDest, time, time);
}
};

await mkdirp(destination);
Expand Down

0 comments on commit 00b44e9

Please sign in to comment.