MCPcopy Create free account
hub / github.com/expo/eas-cli / executeAsync

Method executeAsync

packages/steps/src/BuildStep.ts:213–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

211 }
212
213 public async executeAsync(): Promise<void> {
214 try {
215 this.ctx.logger.info(
216 { marker: BuildStepLogMarker.START_STEP },
217 `Executing build step "${this.displayName}"`
218 );
219 this.status = BuildStepStatus.IN_PROGRESS;
220
221 await fs.mkdir(this.outputsDir, { recursive: true });
222 this.ctx.logger.debug(`Created temporary directory for step outputs: ${this.outputsDir}`);
223
224 await fs.mkdir(this.envsDir, { recursive: true });
225 this.ctx.logger.debug(
226 `Created temporary directory for step environment variables: ${this.envsDir}`
227 );
228
229 if (this.timeoutMs !== undefined) {
230 const abortController = new AbortController();
231
232 let timeoutId: NodeJS.Timeout | undefined;
233 const timeoutPromise = new Promise<void>((_, reject) => {
234 timeoutId = setTimeout(() => {
235 // Reject with timeout error FIRST, before killing the process
236 // This ensures the timeout error wins the race
237 reject(
238 new BuildStepRuntimeError(
239 `Build step "${this.displayName}" timed out after ${this.timeoutMs}ms`
240 )
241 );
242
243 abortController.abort();
244 }, this.timeoutMs);
245 });
246
247 try {
248 await Promise.race([
249 this.command !== undefined
250 ? this.executeCommandAsync({ signal: abortController.signal })
251 : this.executeFnAsync({ signal: abortController.signal }),
252 timeoutPromise,
253 ]);
254 } finally {
255 if (timeoutId) {
256 clearTimeout(timeoutId);
257 }
258 }
259 } else {
260 const executionPromise =
261 this.command !== undefined
262 ? this.executeCommandAsync({ signal: null })
263 : this.executeFnAsync({ signal: null });
264 await executionPromise;
265 }
266
267 this.ctx.logger.info(
268 { marker: BuildStepLogMarker.END_STEP, result: BuildStepStatus.SUCCESS },
269 `Finished build step "${this.displayName}" successfully`
270 );

Callers 15

runAsyncFunction · 0.45
BuildStep-test.tsFile · 0.45
runGenericJobAsyncFunction · 0.45
runCustomBuildAsyncFunction · 0.45
repack.test.tsFile · 0.45
export.test.tsFile · 0.45

Calls 7

executeCommandAsyncMethod · 0.95
executeFnAsyncMethod · 0.95
debugMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected