In mruby how can I run shell commands with %x()
, ``
or system
?
Is there an mgem I can use for it?
Asked
Active
Viewed 249 times
1

Filipe Correia
- 45
- 8
-
Valid question - hopefully mruby can include the answer once that is resolved. – shevy Aug 16 '17 at 15:47
-
once what is resolved? – Filipe Correia Aug 16 '17 at 15:50
1 Answers
1
Try mruby-io
which implementes popen
:
https://github.com/iij/mruby-io/blob/728d313b2c238ac0f41a4aa7e4a88e6a8fee8079/mrblib/kernel.rb#L2-L4
Or type mruby-process
which implements system
: https://github.com/iij/mruby-process/blob/c31010dc0440335a7693fd70ae005c79bd1378ec/src/process.c#L368

take-cheeze
- 83
- 4
-
I found the `system` in mruby-process but it doesn't return anything from the process. I actually implemented a version of the backtick operator, and got a simple version working but it makes a lot more sense to use mruby-io instead. – Filipe Correia Aug 21 '17 at 13:29