@@ -91,7 +91,10 @@ public static bool CommandsExecuted(this InMemoryProcessManager processManager,
91
91
// expression. If this does not resolve a match, we use the regular expression. This enables developers to
92
92
// use either exact matches or regular expression matches as they see fit.
93
93
IProcessProxy matchingProcess = processManager . Processes . FirstOrDefault (
94
- proc => ( proc . FullCommand ( ) == command || Regex . IsMatch ( proc . FullCommand ( ) , command , RegexOptions . IgnoreCase ) )
94
+ proc => ( proc . FullCommand ( ) == command ) ) ;
95
+
96
+ matchingProcess ??= processManager . Processes . FirstOrDefault (
97
+ proc => Regex . IsMatch ( proc . FullCommand ( ) , command , RegexOptions . IgnoreCase )
95
98
&& ! processesConfirmed . Any ( otherProc => object . ReferenceEquals ( proc , otherProc ) ) ) ;
96
99
97
100
if ( matchingProcess == null )
@@ -119,6 +122,10 @@ public static bool CommandsExecutedInWorkingDirectory(this InMemoryProcessManage
119
122
foreach ( string command in commands )
120
123
{
121
124
IProcessProxy matchingProcess = processManager . Processes . FirstOrDefault (
125
+ proc => ( proc . FullCommand ( ) == command
126
+ && proc . StartInfo . WorkingDirectory == workingDir ) ) ;
127
+
128
+ matchingProcess ??= processManager . Processes . FirstOrDefault (
122
129
proc => Regex . IsMatch ( proc . FullCommand ( ) , command , RegexOptions . IgnoreCase )
123
130
&& proc . StartInfo . WorkingDirectory == workingDir
124
131
&& ! processesConfirmed . Any ( otherProc => object . ReferenceEquals ( proc , otherProc ) ) ) ;
0 commit comments