Calling RubyScript via IronRuby with command line parameters or arguments

115 Views Asked by At

We're pretty new to Ruby and very new to IronRuby so please bear with me. We're in C# trying to do something very simple. I've got a ruby script called doExtract.rb and I need to pass it a file called myfile.txt. We've copied all the files required into the /bin folder of the build and they run correctly when called via the command line.

var rubyRuntime = Ruby.CreateRuntime();
var rubyEngine = rubyRuntime.GetEngine("rb");

String fullPath = String.Format("{0} {1}", "doExtract.rb", "myfile.txt");

rubyEngine.ExecuteFile(fullPath);

gives me an error of "Illegal characters in path"

I've searched high & low on the t'interwebs and to no avail.

We've tried adding the search paths to the rubyEngine and using a full path to the myfile.txt but still get the error. If we call a simple ruby script with no parameters then it works fine. We've also tried with escaped slashed both backwards and forwards in the myfile.txt. I'm sure it'd something really stupid that we're not doing !

Any suggestions where we're going wrong ?

Thanks

0

There are 0 best solutions below