Revert "fix recursiveCopy to preserve executable bit (#39505)" (#39588)

This reverts commit 8ec2c5828d.
This commit is contained in:
Christopher Fujino
2019-08-30 15:03:12 -07:00
committed by GitHub
parent 8ec2c5828d
commit 61eab16c37

View File

@@ -124,11 +124,6 @@ void recursiveCopy(Directory source, Directory target) {
else if (entity is File) {
final File dest = File(path.join(target.path, name));
dest.writeAsBytesSync(entity.readAsBytesSync());
// Preserve executable bit
final String modes = entity.statSync().modeString();
if (modes != null && modes.contains('x')) {
makeExecutable(dest);
}
}
}
}
@@ -139,27 +134,6 @@ FileSystemEntity move(FileSystemEntity whatToMove,
.renameSync(path.join(to.path, name ?? path.basename(whatToMove.path)));
}
/// Equivalent of `chmod a+x file`
void makeExecutable(File file) {
// Windows files do not have an executable bit
if (Platform.isWindows) {
return;
}
final ProcessResult result = _processManager.runSync(<String>[
'chmod',
'a+x',
file.path,
]);
if (result.exitCode != 0) {
throw FileSystemException(
'Error making ${file.path} executable.\n'
'${result.stderr}',
file.path,
);
}
}
/// Equivalent of `mkdir directory`.
void mkdir(Directory directory) {
directory.createSync();