#!/usr/pkg/bin/ruby34

require 'rake_compiler_dock'

args = ARGV.empty? ? ['bash'] : ARGV.dup

if $stdin.tty?
  # An interactive session should not leave the container on Ctrl-C
  args << {:sigfw => false}
end

begin
  RakeCompilerDock.exec(*args) do |ok, res|
    exit(res.exitstatus)
  end
rescue RakeCompilerDock::DockerIsNotAvailable
  exit(-1)
end
