Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy execute permissions for apphost for non-Windows #1338

Merged
merged 1 commit into from
Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Tasks/Microsoft.NET.Build.Tasks/EmbedAppNameInHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ protected override void ExecuteCore()
{
Directory.CreateDirectory(destinationDirectory);
}
File.WriteAllBytes(ModifiedAppHostPath, array);

// Copy AppHostSourcePath to ModifiedAppHostPath so it inherits the same attributes\permissions.
File.Copy(AppHostSourcePath, ModifiedAppHostPath);

// Re-write ModifiedAppHostPath with the proper contents.
using (FileStream fs = new FileStream(ModifiedAppHostPath, FileMode.Truncate, FileAccess.ReadWrite, FileShare.Read))
{
fs.Write(array, 0, array.Length);
}
}

// See: https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public static void Main()
});

Command.Create(selfContainedExecutableFullPath, new string[] { })
.EnsureExecutable()
.CaptureStdOut()
.Execute()
.Should()
Expand Down Expand Up @@ -364,8 +363,7 @@ public static void Main()
.And
.OnlyHaveNativeAssembliesWhichAreInFolder(rid, publishDirectory.FullName, testProject.Name);

runCommand = Command.Create(selfContainedExecutableFullPath, new string[] { })
.EnsureExecutable();
runCommand = Command.Create(selfContainedExecutableFullPath, new string[] { });
}
else
{
Expand Down