11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci/** 41cb0ef41Sopenharmony_ci * Handle a Promise from running code that potentially does Top-Level Await. 51cb0ef41Sopenharmony_ci * In that case, it makes sense to set the exit code to a specific non-zero value 61cb0ef41Sopenharmony_ci * if the main code never finishes running. 71cb0ef41Sopenharmony_ci */ 81cb0ef41Sopenharmony_cifunction handleProcessExit() { 91cb0ef41Sopenharmony_ci process.exitCode ??= 13; 101cb0ef41Sopenharmony_ci} 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cimodule.exports = { 131cb0ef41Sopenharmony_ci handleProcessExit, 141cb0ef41Sopenharmony_ci}; 15