Class: Polytrix::Executors::WindowsChallengeRunner

Inherits:
ChallengeRunner
  • Object
show all
Defined in:
lib/polytrix/executors/windows_challenge_executor.rb

Constant Summary collapse

PS_OPTIONS =
'-NoProfile -ExecutionPolicy Bypass'

Instance Attribute Summary

Attributes included from Polytrix::Executor

#env, #executor

Instance Method Summary collapse

Methods inherited from ChallengeRunner

create_runner, #run_challenge, #run_command

Methods included from Polytrix::Executor

#execute

Methods included from Util::FileSystem

#find_file, #relativize

Methods included from Util::String

included

Methods included from Util::String::ClassMethods

#ansi2html, #escape_html, #highlight, #slugify

Instance Method Details

#challenge_command(challenge_script, _basedir = Dir.pwd) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/polytrix/executors/windows_challenge_executor.rb', line 6

def challenge_command(challenge_script, _basedir = Dir.pwd)
  # I don't know a simple powershell replacement for &&
  # See http://stackoverflow.com/questions/2416662/what-are-the-powershell-equivalent-of-bashs-and-operators
  if File.exist? 'scripts/wrapper.ps1'
    command = "./scripts/wrapper.ps1 #{challenge_script}"
  else
    command = "./#{challenge_script}"
  end
  "PowerShell #{PS_OPTIONS} -Command \"#{command}\""
end