@@ -185,23 +185,26 @@ private function retrieveOutputs(string $environment, array $awsCredentials, ?st
185
185
// If plugins add extra output afterward, it should be ignored.
186
186
$ outputsResults = preg_match ('/Stack Outputs:\n(( {2}[ \S]+\n)+)/ ' , $ infoOutput , $ matches );
187
187
// Also try to extract the stack name and region
188
- $ stackResults = preg_match ('/stack: (.*)\n/ ' , $ infoOutput , $ matches );
189
- $ regionResults = preg_match ('/region: (.*)\n/ ' , $ infoOutput , $ matches );
188
+ $ stackResults = preg_match ('/stack: (.*)\n/ ' , $ infoOutput , $ stackMatches );
189
+ $ regionResults = preg_match ('/region: (.*)\n/ ' , $ infoOutput , $ regionMatches );
190
190
if ($ outputsResults && $ stackResults && $ regionResults ) {
191
191
try {
192
192
$ stackOutputs = Yaml::parse ($ matches [1 ]);
193
193
if (! is_array ($ stackOutputs )) {
194
194
throw new Exception ('Invalid stack outputs in the "serverless info" output ' );
195
195
}
196
196
$ stackOutputs = $ this ->cleanupCfOutputs ($ stackOutputs );
197
- $ stackName = $ matches [2 ];
197
+
198
+ $ stackName = $ stackMatches [1 ];
198
199
if (! is_string ($ stackName )) {
199
200
throw new Exception ('Invalid stack name in the "serverless info" output ' );
200
201
}
201
- $ region = $ matches [3 ];
202
+
203
+ $ region = $ regionMatches [1 ];
202
204
if (! is_string ($ region )) {
203
205
throw new Exception ('Invalid region in the "serverless info" output ' );
204
206
}
207
+
205
208
return array_merge ([
206
209
'stack ' => $ stackName ,
207
210
'region ' => $ region ,
0 commit comments