我使用了一些基于github的代码,用于处理代码的测试和编译。在其中有一个Ceedling可用命令的扩展(我将使用的测试工具),它在名为“rakefile.rb”的文件中使用Ruby。
我正在尝试运行以下命令:
desc "Convert the output binary to a hex file"
task :convert => :release do
cmd = "\"C:/Program Files (x86)/Microchip/xc16/v1.23/bin\"\\\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf"
puts "Generating Output.hex..."
puts cmd
sh cmd
end
如果我把下面的代码放到我的“使用Ruby启动命令提示符”程序中,那么输出是正确的并采取行动:
"C:/Program Files (x86)/Microchip/xc16/v1.23/bin"\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf
如果我不包含“和”,则该程序将无效。
目前我得到了输出:
Generating Output.hex...
"C:/Program Files (x86)/Microchip/xc16/v1.23/bin"\\xc16-bin2hex ./build/release/Output.elf -a -omf=elf
rake aborted!
Command failed with status (127): ["C:/Program Files (x86)/Microchip/xc16/v1....]
rakefile.rb:16:in `block in <top (required)>'
C:/Ruby24-x64/bin/ceedling:23:in `load'
C:/Ruby24-x64/bin/ceedling:23:in `<main>'
Tasks: TOP => convert
(See full trace by running task with --trace)
我做错了什么?我在哪里可以阅读更多关于Ruby的基础知识?
答案 0 :(得分:1)
根据您在聊天中发布的错误,根本问题似乎是rake任务未找到sh
,
这是一个运行Linux shell脚本语言的可执行文件。
我认为最简单的选择是
通过cygwin,mingw或gitbash(请参阅this answer)在Windows上安装sh
或
在vm或容器上运行linux