ruby on rails - Unable to manipulate a byte array -


I pass a byte array from inside my rail app to another ruby ​​script (still inside my rail app) For example:

  `./app/animations/fade.sh" \ x01 \ x01 \ x04 \ x00 "& amp;  

yield logic error (string is empty byte)

I think how can I create this string and pass it in my script I'm stumped, which is it like this Will use the following:

  @sp.write ["# {ARGV [0]}", "f", "\ x12"]  

I would like, if possible, make the string (on my rail app) like this:

  lead = "\ x01 # {led.id} \ x04 \ x00"  

But I'm getting the argument error (contains zero bytes in the string) error is there any way that I can make this string with elements in my rail app, then it's my external Can I send in script?

itemprop = "text">

You just need to pass data through standard input, not on the command line. You can use for this purpose:

  IO.popen (". / App / animation / fade.sh", "w +"). F | F.write "\ x01 \ x01 \ x04 \ x00" end  

and read towards:

  input = $ stdin.read @sp (JIS By the way, this is more common for ruby ​​scripts  .rb  instead of  names [input, "F", "\ x12"]  

.sh ; If fade.sh stands for Ruby script, as I believe with syntax, which you use in its example content, you can call it fade You may want to give it. RB )


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -