Skip to content

Spawn on Windows #38

@frankshearar

Description

@frankshearar
def run_image_with_cmd(vm_name, arr_of_vm_args, image_name, cmd, timeout = 240)
  log(cmd)
  base_cmd = "#{vm_name} #{arr_of_vm_args.join(" ")} \"#{SRC}/target/#{image_name}.image\" #{as_relative_path(Pathname.new(cmd))}"
  case identify_os
    when "windows" then system(base_cmd)
  else
    log("spawning with timeout #{timeout.to_s} seconds: nice #{base_cmd}")
    pid = spawn("nice #{base_cmd}", err: STDERR, out: STDOUT)
    future {
      sleep(timeout.seconds)
      log("Killed command for exceeding allotted time: nice #{base_cmd}.")
      Process.kill('KILL', pid)
    }
    Process.wait(pid)
  end
end

Let's try spawn on Windows too, and just nice on non-Windows platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions