2012-06-04 171 views
0

我有一個shell命令寄存器的輸出,我運行紅寶石:紅寶石:從shell命令

cat_command = "cat 0.mpg 7.mpg 15.mpg 8.mpg 1.mpg > intermed.mpg" 

%x[cd #{my_dir} && #{cat_command}] 

它返回

cat: 8.mpg: No such file or directory 

如何抓住這個響應(挽救/錯誤處理)。在紅寶石?

回答

0

居然想通了..

stderr = Open3.popen3("cat 0.mpg 7.mpg 15.mpg 8.mpg 1.mpg > intermed.mpg") 
stderr[2].gets 
    => "cat: 0.mpg: No such file or directory\n"