taybenlor / runno

Browser-based runtime for programming languages and WASI binaries.

Home Page:https://runno.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running ruby in headless mode fails?

jmduke opened this issue · comments

Hi there! Runno is great; I'm working on making a little app that spins up a repl for each language. I'm not the worlds biggest fan of the default UI was starting to strip it out and replace it with 'raw' CodeMirror, but when I run headlessRunCode on 0.5.2 I get a Ruby error:

image

<internal:/wlr-rubies/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- /ruby-3.2.0/.rubyopts.rb (LoadError)
	from <internal:/wlr-rubies/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'

This does not happen for js or Python. For posterity, the specific call is:

runno?.headlessRunCode("ruby", prompt, "")

Any idea what might be the case here? Thank you!

Hey there!

I remember there being some issues when I set it up. It looks like in my config I have a default arg:

args: ["-r", "/ruby-3.2.0/.rubyopts.rb", entryPath],

Which you can find here: https://github.com/taybenlor/runno/blob/9b9dc1f3142cf883fd37842f73f51bfe7d837ded/packages/runtime/src/commands.ts#L51C11-L51C63

I can't look at this until the weekend but I suspect there's something related to that.


RE: The default styling - I think it would make sense to ship something more vanilla. What would you like to see changed?

Thanks heaps!

Just thinking about workarounds, you could use runno-run without editor set. That will give you the interactive runtime but without the editor. You can then set the code with something like:

const runElement = querySelector("runno-run");
runElement.code = yourCode;

// Later on run the code
runElement.run();

Have a read through this file: https://github.com/taybenlor/runno/blob/main/packages/runtime/src/elements/run.ts

And have a look at the examples (clone this repo locally and then look at the examples folder).

Thank you for such a quick response! Will try this out in the morning.

That approach did the trick! 🎊

image

Hi @jmduke this has been fixed in v0.5.2 thanks for reporting!