Comments (7)
Thanks for the report. This is documented in the README and is fundamental to the architecture, but I'd love to see any suggestions for a non-forking solution that is able to handle fatal errors. Boris is different to other PHP REPLs, in that it was built specifically to deal with fatal errors, which basically means each statement must be executed in a new process, in case it dies. If you don't care about the REPL quitting on fatal errors, you may be interested in https://github.com/ieure/php_repl.
I'll leave this ticket open in case somebody can come up with an approach that doesn't rely on the ability to fork.
from boris.
This isn't a way around it but a way to get it running if you have access to php.ini. I used this guide to get pcntl running for MAMP on OS X.
http://stackoverflow.com/questions/5230255/how-to-enable-process-control-extension-pcntl-in-php-mamp
from boris.
Thanks for this. The idea of the forking is fundamental to how boris deals with fatal errors (actually, you may want to try since I reverted that last commit just now, if you found boris exited on error... I just fixed an issue).
I'm still keen to find a solution that works on Windows :)
from boris.
Not a problem. Windows, though. Oooh boy.
from boris.
I don't think the reliance on the process control functions or the posix functions can be avoided at all at this stage... Boris simply could not exist without them. I may consider writing an installer script that tries to install what it needs from PECL, however. It may also be possible to package Boris up into a Debian package with dependencies formally specified, so they can be installed.
from boris.
I ran into the same problem. The following article is very helpful with enabling pcntl on a default Mac OS X php installation:
http://moffe42.blogspot.com.au/2012/06/installing-pcntl-for-php-on-osx-lion.html
from boris.
I'll leave this ticket open in case somebody can come up with an approach that doesn't rely on the ability to fork.
One alternative to pcntl_fork
is to "recreate" the current PHP environment by starting a new PHP in which you load all the same code and update all global state to match the current state. PHPUnit does this when you configure runTestInSeparateProcess
, to avoid a dependency on fork
.
See sebastianbergmann/phpunit#909
and /src/Framework/TestCase.php:783
This is somewhat fragile, and more likely to work for something like PHPUnit which is running from PHP source files, than for Boris which is running from user input. Further, if there is any code which has side-effects, it may get re-run on each pseudo-fork.
from boris.
Related Issues (20)
- Feature request: add dependencies to the readme HOT 1
- Broken backwards compatibility HOT 11
- Previous and next command with up and down arrow not working HOT 7
- Segmentation Fault HOT 11
- Bug: "use" and "::class" doesn't return the same class. HOT 2
- Undefined variable: boris in .borisrc HOT 1
- CTRL+U incorrect behaviour HOT 4
- Delete key produces tilde HOT 4
- Unicode characters were not accepted HOT 2
- Curly braces used for object property dereferencing cause parse error
- Demo URL is broken in readme file HOT 1
- Can not echo global variable HOT 1
- Packagist no longer has different version based of tags HOT 3
- HTTP Clients may fail silently
- SemVer breakage. HOT 1
- do/while loop doesn't work. HOT 1
- Composer >1.3.0 compatibility
- Support strict types.
- Redefine class/functions
- Demo link returns "Not Found"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boris.