| 110 | } |
| 111 | |
| 112 | async function main() { |
| 113 | const options = parseArgs(); |
| 114 | |
| 115 | // Read hex file |
| 116 | let hexContent: string; |
| 117 | try { |
| 118 | hexContent = readFileSync(options.hexFile, "utf-8"); |
| 119 | } catch (err) { |
| 120 | console.error(`Error reading hex file '${options.hexFile}': ${err}`); |
| 121 | exit(1); |
| 122 | } |
| 123 | |
| 124 | if (options.verbose) { |
| 125 | console.log(`Executing: ${options.hexFile}`); |
| 126 | console.log(`Timeout: ${options.timeout}s\n`); |
| 127 | } |
| 128 | |
| 129 | // Execute program |
| 130 | const exitCode = await executeProgram(hexContent, options); |
| 131 | exit(exitCode); |
| 132 | } |
| 133 | |
| 134 | // Run main function |
| 135 | main().catch(err => { |