-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quit callback overwrites the quit callback template (#937)
By default, even if you add a `quit` method in `emscryptenOptions` : ``` const php = await NodePHP.load( '8.2', { emscriptenOptions : { quit : ( status, toThrow ) => { if( status === 0 ){ process.exit() } return toThrow } } } ); ``` it is overwritten by the actual one on line `57` in `node-php.ts` : ``` quit: function (code, error) { throw error; }, ``` This PR is moving this template callback to be overwritten by `emscryptenOptions` object given by user. ## What problem is it solving? To avoid throwing error from `php.exit()` even if it is exiting quietly. ## Testing Instructions ``` const php = await NodePHP.load( '8.2', emscriptenOptions : { quit : ( status, toThrow ) => { if( status === 0 ){ process.exit() } return toThrow } } } ); php.exit(0); ``` This should display nothing.
- Loading branch information
Showing
3 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters