-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Improve Process support on MacCatalyst #126472
Description
- Performance: prefer
posix_spawnwhen available (it has provide up to x100 boost on macOS arm64). It's a matter of extending what Prefer posix_spawn on OSX #126063 did by adding|| defined(TARGET_MACCATALYST)here:
- #if defined(TARGET_OSX)
+ #if defined(TARGET_OSX) || defined(TARGET_MACCATALYST)- Perform
IsTerminalcheck for MacCatalyst:
We never performed the extra configuration on these platforms:
For IsiOSLike platforms:
runtime/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
Line 14 in 1d46816
| <IsiOSLike Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst' or '$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos'">true</IsiOSLike> |
We were including:
runtime/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
Lines 298 to 300 in 1d46816
| <ItemGroup Condition="'$(TargetPlatformIdentifier)' != '' and '$(TargetPlatformIdentifier)' != 'windows' and '$(IsiOSLike)' == 'true'"> | |
| <Compile Include="System\Diagnostics\Process.ConfigureTerminalForChildProcesses.iOS.cs" /> | |
| </ItemGroup> |
That was a nop:
Lines 6 to 20 in 1d46816
| public partial class Process | |
| { | |
| /// These methods are used on other Unix systems to track how many children use the terminal, | |
| /// and update the terminal configuration when necessary. | |
| [Conditional("unnecessary")] | |
| internal static void ConfigureTerminalForChildProcesses(int increment, bool configureConsole = true) | |
| { | |
| } | |
| static partial void SetDelayedSigChildConsoleConfigurationHandler(); | |
| private static bool AreChildrenUsingTerminal => false; | |
| } | |
| } |
The fix will be to stop treating MacCatalyst as iOSLike in the project file:
runtime/src/libraries/System.Diagnostics.Process/src/System.Diagnostics.Process.csproj
Line 14 in ab81350
| <IsiOSLike Condition="'$(TargetPlatformIdentifier)' == 'maccatalyst' or '$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos'">true</IsiOSLike> |
and extend pal_log.m (context) with sth like:
int32_t SystemNative_IsATty(intptr_t fd)
{
#if defined(TARGET_MACCATALYST)
return isatty(ToFileDescriptor(fd));
#elif defined(TARGET_IOS) || defined(TARGET_TVOS)
// there is no terminal on these platforms
(void)fd;
return 0;
#endif
}We need to get #126306 merged first and ensure all the MacCatalyst and iOS builds and tests are green.