Sarthak-Pandey opened a new pull request, #3859: URL: https://github.com/apache/nuttx-apps/pull/3859
## Summary Fixes #2855: Duktape crashes while you try to start it after interrupting it with ctrl+c. When Duktape was interrupted via `Ctrl+C` (SIGINT), the task was abruptly terminated by NuttX's default abnormal termination handler without destroying the Duktape heap. On flat-memory architectures such as ESP32, this leaked heap allocations and corrupted internal state, causing subsequent invocations of `duk` to crash or panic. This PR: 1. Enables `DUK_CMDLINE_SIGNAL` in `apps/interpreters/duktape/Makefile`. 2. Defines `DUK_USE_INTERRUPT_COUNTER` and `DUK_USE_EXEC_TIMEOUT_CHECK` in `duk_config.h` so the Duktape bytecode executor periodically checks for execution interruption. 3. Implements an async-signal-safe interrupt handler and execution timeout check in `duk_cmdline.c` that safely halts bytecode execution, unwinds the stack, and invokes `destroy_duktape_heap()` to return all allocated memory before exiting. ## Impact - Users can safely interrupt running Duktape scripts with Ctrl+C and immediately run them again without board crashes or heap exhaustion. ## Testing - Verified patch applies cleanly against Duktape 2.5.0. - Verified signal handler registers and timeout check is hooked properly during bytecode execution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
