1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-28 16:30:58 +01:00

Use phutil functions to copy/move files

Summary:
The `cp` and `mv` commands, when run from a Windows
environment, error out.  Use library functions from `Filesystem`
for cross-platform compatibility.

Test Plan:
Ran `arc lint` with auto-fix lint errors on both Linux and
Windows.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Spies: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D16273
This commit is contained in:
Alex Vandiver 2016-07-11 13:39:57 -07:00
parent 4d4d16f259
commit 8f69a5c378

View file

@ -42,12 +42,13 @@ final class ArcanistLintPatcher extends Phobject {
// supported under OSX.
if (Filesystem::pathExists($path)) {
// This path may not exist if we're generating a new file.
execx('cp -p %s %s', $path, $lint);
Filesystem::copyFile($path, $lint);
}
Filesystem::writeFile($lint, $data);
list($err) = exec_manual('mv -f %s %s', $lint, $path);
if ($err) {
try {
Filesystem::rename($lint, $path);
} catch (FilesystemException $e) {
throw new Exception(
pht(
"Unable to overwrite path '%s', patched version was left at '%s'.",