Giter Club home page Giter Club logo

Comments (7)

d11wtq avatar d11wtq commented on September 25, 2024

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.

michaelwills avatar michaelwills commented on September 25, 2024

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.

d11wtq avatar d11wtq commented on September 25, 2024

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.

michaelwills avatar michaelwills commented on September 25, 2024

Not a problem. Windows, though. Oooh boy.

from boris.

d11wtq avatar d11wtq commented on September 25, 2024

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.

melvinmt avatar melvinmt commented on September 25, 2024

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.

RichardBradley avatar RichardBradley commented on September 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.