Comments (4)
@mojavelinux I can get the tests to pass on ruby-2.1.1 using open3 instead of posix-spawn.
# Replace this @pid, @in, @out, @err = popen4(script) with
@in, @out, @err, @wait = Open3.popen3(script)
@pid = @wait[:pid]
So, in theory at least, a solution like this with Open3.popen3
might work for JRuby. POSIX::Spawn is much more efficient, though, so the popen3 solution should be implemented as the fallback option specifically for JRuby.
The other dependency with native extensions is Yajl. If I simply gsub instances of Yajl with JSON, then I get a couple of errors using 2.1.1, and under JRuby it hangs as you describe here. So I get the feeling that the real issue is in the dumping and loading of the json; that there is something specific in the way that Yajl does this. Perhaps a good first step would be to use 'multi_json' with the Yajl adapter, so that swapping in another adapter becomes trivial.
from pygments.rb.
Just had a chance to quickly do a few tests on JRuby too. It works if I use multi_json with
MultiJson.engine = 'json_gem'
The only thing to pay attention to is that you must close the input stream @in
before reading from @out
(for example, by calling @in.close
in get_header
). Hope this helps, @mojavelinux.
from pygments.rb.
For reference, if you install the following gem:
$ gem install pygments.rb-jruby
Then replace the call to popen4 as @bartkamphorst suggested:
require 'open3' if RUBY_ENGINE == 'jruby'
...
@in, @out, @err, @wait = Open3.popen3(script)
@pid = @wait[:pid]
Then it works. Of course, that's an older version of the gem ;(
from pygments.rb.
I put together a pull request that implements these changes. I'm happy to say it works as expected!
from pygments.rb.
Related Issues (20)
- Broken symlink in gem (find_error.py) HOT 8
- github.py is included in pygments-main HOT 2
- Possibility to add a custom lexer HOT 8
- Liquid Exception in markdown format HOT 1
- Reanimate JRuby CI
- Raku support HOT 1
- support pygments >= 2.7.1 HOT 1
- Becoming a maintainer HOT 6
- Set up Rubocop lint checking in CI
- Race condition between watchdog/main thread leads to "Thread killed" on JRuby
- Old-fashioned questions
- Add an API to query underlying Pygments version
- undefined method 'create' HOT 4
- Tests break against python3-pygments (=2.10.0+dfsg-1) HOT 2
- env: python: No such file or directory HOT 2
- Broken pipe error in Mentos HOT 22
- Update pygments to 2.14.0
- Virtual environment Pythons are ignored on Windows
- `guess()` from Ruby HOT 1
- Update Pygments HOT 2
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 pygments.rb.