Ruby on Raspberry Pi - 为什么我的脚本被杀了?

时间:2016-04-06 16:44:06

标签: ruby raspberry-pi raspberry-pi2 ruby-2.3

我使用RaspPi Model B +来运行一个计算密集的简单Ruby(-v 2.3.0)脚本 - 基本上我生成一个包含5个字母组合的列表,检查每个可能的组合如果它们通过了一些测试,则将它们写入输出文件。

这个脚本将永远在我的笔记本电脑上运行,因为它必须运行多少次迭代,所以我想我只是将它运行到已经在我的桌面上运行的RaspPi并让它它会流失几天。

我通过OSX屏幕共享登录RaspPi,运行脚本,它开始工作。如果我关闭屏幕共享,稍后脚本会返回" kill"并停止工作。

我在这做什么?这是退出屏幕共享杀死进程的问题,还是RaspPi上的记忆问题?

Code I' run:

$f = "output.txt"
a = ('a'..'z').to_a
a = a*5
p "Creating combos..."
possibles = a.combination(5).to_a

p "Combos made."
p "Generating tests..."

def test_case(arr)
  vowels = ['a','e','i','o','u','y']
  if (vowels & arr).empty? == false
    p arr.join.to_s + " added!"
    case = "kr" + arr.join.to_s
    File.open($f,'a') do |file|
      file.write(case)
      file.write("; ")
    end
  end
end

possibles.each {|x| test_case(x)}
p "Cases generated!"

0 个答案:

没有答案