I have a compiled c++ file that I would like to run from within a temporary directory in ruby:
folder = Dir.mktmpdir
begin
puts folder
File.open("#{folder}/input.xml", 'w') { |file| file.write(builder.to_xml) }
ensure
system '.././program'
FileUtils.remove_entry folder
end
The above code properly creates all the desired file/folder, but does not run the system call, and does not produce an error. I have tried the all of the varieties listed here: Calling shell commands from Ruby but cannot seem to get it to function. If I comment out the file deletion line and manually go and execute the command listed above, the program functions properly. Also, if I instead save the file to the same location as the ./program, the ./program works. What is preventing me from running the command from a sub-folder?