Title: Catch exceptions to avoid restarting session · Issue #50 · wp-cli/shell-command · GitHub
Open Graph Title: Catch exceptions to avoid restarting session · Issue #50 · wp-cli/shell-command
X Title: Catch exceptions to avoid restarting session · Issue #50 · wp-cli/shell-command
Description: Feature Request Yes, I reviewed the contribution guidelines. Describe your use case and the problem you are facing Making typos/etc often results in a fatal error, and the session crashes and has to be restarted. After restarting, I have...
Open Graph Description: Feature Request Yes, I reviewed the contribution guidelines. Describe your use case and the problem you are facing Making typos/etc often results in a fatal error, and the session crashes and has t...
X Description: Feature Request Yes, I reviewed the contribution guidelines. Describe your use case and the problem you are facing Making typos/etc often results in a fatal error, and the session crashes and has t...
Opengraph URL: https://github.com/wp-cli/shell-command/issues/50
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Catch exceptions to avoid restarting session","articleBody":"## Feature Request\r\n\r\n- [x] Yes, I reviewed the [contribution guidelines](https://make.wordpress.org/cli/handbook/contributing/).\r\n\r\n**Describe your use case and the problem you are facing**\r\n\r\nMaking typos/etc often results in a fatal error, and the session crashes and has to be restarted. After restarting, I have to recreate any variables, includes, etc from scratch, without making any fatal errors. That often makes it just too frustrating to use.\r\n\r\n\r\n```sh\r\n> wp shell\r\nwp> require 'foo.txt';\r\nWarning: require(foo.txt): Failed to open stream: No such file or directory in phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(32) : eval()'d code on line 1\r\nFatal error: Uncaught Error: Failed opening required 'foo.txt' (include_path='.:/usr/local/Cellar/php/8.0.0_1/share/php/pear') in phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(32) : eval()'d code:1\r\nStack trace:\r\n#0 phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(32): eval()\r\n#1 phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/Shell_Command.php(51): WP_CLI\\Shell\\REPL->start()\r\n#2 [internal function]: Shell_Command->__invoke(Array, Array)\r\n#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(98): call_user_func(Array, Array, Array)\r\n#4 [internal function]: WP_CLI\\Dispatcher\\CommandFactory::WP_CLI\\Dispatcher\\{closure}(Array, Array)\r\n#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(451): call_user_func(Object(Closure), Array, Array)\r\n#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(371): WP_CLI\\Dispatcher\\Subcommand->invoke(Array, Array, Array)\r\n#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(394): WP_CLI\\Runner->run_command(Array, Array)\r\n#8 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1160): WP_CLI\\Runner->run_command_and_exit()\r\n#9 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\\Runner->start()\r\n#10 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(74): WP_CLI\\Bootstrap\\LaunchRunner->process(Object(WP_CLI\\Bootstrap\\BootstrapState))\r\n#11 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(27): WP_CLI\\bootstrap()\r\n#12 phar:///usr/local/bin/wp/php/boot-phar.php(11): include('phar:///usr/loc...')\r\n#13 /usr/local/bin/wp(4): include('phar:///usr/loc...')\r\n#14 {main}\r\n thrown in phar:///usr/local/bin/wp/vendor/wp-cli/shell-command/src/WP_CLI/Shell/REPL.php(32) : eval()'d code on line 1\r\nError: There has been a critical error on this website.Learn more about debugging in WordPress. There has been a critical error on this website.\r\n```\r\n\r\n\r\n\r\n**Describe the solution you'd like**\r\n\r\nPHP's REPL is able to catch fatals and continue running:\r\n\r\n```sh\r\nphp > $foo = 'stuff';\r\nphp > echo $foo;\r\nstuff\r\nphp > require 'foo.txt';\r\n\r\nWarning: require(foo.txt): Failed to open stream: No such file or directory in php shell code on line 1\r\n\r\nWarning: Uncaught Error: Failed opening required 'foo.txt' (include_path='.:/usr/local/Cellar/php/8.0.0_1/share/php/pear') in php shell code:1\r\nStack trace:\r\n#0 {main}\r\n thrown in php shell code on line 1\r\nphp > echo $foo;\r\nstuff\r\n```\r\n\r\nIs that possible for `wp shell` ?","author":{"url":"https://github.com/iandunn","@type":"Person","name":"iandunn"},"datePublished":"2020-12-05T17:00:31Z","url":"https://github.com/wp-cli/shell-command/issues/50"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:21d9b366-ef40-15dc-981f-ed1c190cfad0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D1C:D23AD:109BC67:160E025:6AFA23FC |
| html-safe-nonce | e08e952605680a6bf028183ad66f7d919e832f4a9406b323a14327d5d8560719 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDFDOkQyM0FEOjEwOUJDNjc6MTYwRTAyNTo2QUZBMjNGQyIsInZpc2l0b3JfaWQiOiI1NDQ0NjY1MDM4NjAzOTUzMTQ4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | deaf13cf7df9d0e921796a38af5eb4f9d3c00ff318ae69b3d13ddc45046417c9 |
| hovercard-subject-tag | issue:757721006 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/wp-cli/shell-command/50/issue_layout |
| twitter:image | https://opengraph.githubassets.com/280cacdf49540434c3633ce8e889daf3101b43712cb538c5256c15623f20348c/wp-cli/shell-command/issues/50 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/280cacdf49540434c3633ce8e889daf3101b43712cb538c5256c15623f20348c/wp-cli/shell-command/issues/50 |
| og:image:alt | Feature Request Yes, I reviewed the contribution guidelines. Describe your use case and the problem you are facing Making typos/etc often results in a fatal error, and the session crashes and has t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | iandunn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/wp-cli/shell-command git https://github.com/wp-cli/shell-command.git |
| octolytics-dimension-user_id | 1570774 |
| octolytics-dimension-user_login | wp-cli |
| octolytics-dimension-repository_id | 85307675 |
| octolytics-dimension-repository_nwo | wp-cli/shell-command |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 85307675 |
| octolytics-dimension-repository_network_root_nwo | wp-cli/shell-command |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width