Skip to content

Commit 89a6456

Browse files
committed
Try with grep
1 parent a4f9bb0 commit 89a6456

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,12 @@ The .NET Foundation licenses this file to you under the MIT license.
342342
<_IgnoreLinkerWarnings Condition="'$(TargetOS)' == 'OSX'">true</_IgnoreLinkerWarnings>
343343

344344
<!-- some flags are not supported by older versions of linkers which we care about -->
345-
<_UnsupportedLinkerOptionRegex>.*(nostart-stop-gc).*</_UnsupportedLinkerOptionRegex>
345+
<_UnsupportedLinkerOptionPattern>(nostart-stop-gc)</_UnsupportedLinkerOptionPattern>
346346
</PropertyGroup>
347347

348-
<Exec Command="&quot;$(CppLinker)&quot; @(CustomLinkerArg, ' ')" Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" CustomWarningRegularExpression="$(_UnsupportedLinkerOptionRegex)" />
348+
<!-- redirect stdout to temporary stream so we can pipe stderr to filter out ignorable warnings then reset the streams; this method preserves status code -->
349+
<Exec Command="((((&quot;$(CppLinker)&quot; @(CustomLinkerArg, ' ') 2&gt;&amp;1 1&gt;&amp;3; echo $? &gt;&amp;2) | grep -vE &apos;$(_UnsupportedLinkerOptionPattern)&apos;) 2&gt;&amp;1 1&gt;&amp;3) | (read xs; exit $xs)) 3&gt;&amp;1"
350+
Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' != 'Static'" IgnoreStandardErrorWarningFormat="$(_IgnoreLinkerWarnings)" />
349351
<Exec Command="&quot;$(CppLibCreator)&quot; @(CustomLibArg, ' ')" Condition="'$(TargetOS)' != 'windows' and '$(NativeLib)' == 'Static'" />
350352

351353
<WriteLinesToFile File="$(NativeIntermediateOutputPath)link.rsp" Lines="@(CustomLinkerArg)" Overwrite="true" Encoding="utf-8" Condition="'$(TargetOS)' == 'windows' and '$(NativeLib)' != 'Static'" />

0 commit comments

Comments
 (0)