You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(cli-integ): make it possible to run on GitHub Actions (#33175)
Migrate some changes back from the new testing repo. These changes are necessary to make the tests run on GitHub Actions.
If we keep them here, in the future we can do a `cp -R` on the test directory. If not, we'll have to do manual sorting on every copy over, which is annoying and easy to make mistakes in.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
writeToOutputs(`action output is ${JSON.stringify(output)}\n`);
217
222
actionOutput=output;
218
223
actionSucceeded=true;
219
-
}).catch((error)=>{
220
-
writeToOutputs(`action error is ${error}`);
224
+
}catch(error: any){
225
+
writeToOutputs(`action error is ${error}\n`);
221
226
actionSucceeded=false;
222
227
actionOutput=error;
223
-
}).finally(()=>{
224
-
writeToOutputs('terminate sam sub process');
228
+
}finally{
229
+
writeToOutputs('terminate sam sub process\n');
225
230
killSubProcess(child,command.join(' '));
226
-
});
231
+
}
227
232
}
228
233
}
229
234
@@ -234,6 +239,7 @@ export async function shellWithAction(
234
239
()=>{
235
240
if(!actionExecuted){
236
241
reject(newError(`Timed out waiting for filter ${JSON.stringify(filter)} to appear in command output after ${actionTimeoutSeconds} seconds\nOutput so far:\n${Buffer.concat(out).toString('utf-8')}`));
242
+
killSubProcess(child,command.join(' '));
237
243
}
238
244
},actionTimeoutSeconds*1_000,
239
245
).unref();
@@ -242,20 +248,22 @@ export async function shellWithAction(
242
248
child.stdout!.on('data',chunk=>{
243
249
writeToOutputs(chunk);
244
250
stdout.push(chunk);
245
-
executeAction(chunk);
251
+
voidmaybeExecuteAction(chunk);
246
252
});
247
253
248
254
child.stderr!.on('data',chunk=>{
249
255
writeToOutputs(chunk);
250
256
if(options.captureStderr??true){
251
257
stderr.push(chunk);
252
258
}
253
-
executeAction(chunk);
259
+
voidmaybeExecuteAction(chunk);
254
260
});
255
261
256
262
child.once('error',reject);
257
263
258
-
child.once('close',code=>{
264
+
// Wait for 'exit' instead of close, don't care about reading the streams all the way to the end
265
+
child.once('exit',(code,signal)=>{
266
+
writeToOutputs(`Subprocess has exited with code ${code}, signal ${signal}\n`);
0 commit comments