Skip to content

Commit 7d338a5

Browse files
committed
SetFlags
1 parent af741b3 commit 7d338a5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/Microsoft.DotNet.HotReload.Watch.Aspire.Tests/DotNetWatchLauncherTests.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,32 @@ public async Task AspireWatchLaunch()
2929
WorkingDirectory = projectDir,
3030
};
3131

32+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
33+
{
34+
var flags = File.GetUnixFileMode(path);
35+
if (!flags.HasFlag(UnixFileMode.UserExecute))
36+
{
37+
File.SetUnixFileMode(path, flags | UnixFileMode.UserExecute);
38+
}
39+
}
40+
3241
using var process = new AwaitableProcess(logger);
33-
process.Start(startInfo);
42+
try
43+
{
44+
process.Start(startInfo);
45+
}
46+
catch (Exception ex)
47+
{
48+
logger.WriteLine($"Failed to start process: {ex.Message}");
49+
logger.WriteLine($"File.Exists({path})={File.Exists(path)}");
50+
51+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
52+
{
53+
logger.WriteLine($"File.GetUnixFileMode()={File.GetUnixFileMode(path)}");
54+
}
55+
56+
throw;
57+
}
3458

3559
await process.GetOutputLineAsync(success: line => line.Contains("dotnet watch ⌚ Waiting for changes"), failure: _ => false);
3660
}

0 commit comments

Comments
 (0)