   process.exit 1
 
 
+exec = (cmd, keepOutput) ->
+  if keepOutput
+    execSync cmd
+  else
+    execSync cmd, stdio: 'ignore'
+
+
 readFile = (path) ->
   fs.readFileSync path, encoding: 'ascii'
 

launch = ({name, device}) ->
  log 'Building Xcode project'
  try
    execSync "
             xcodebuild
             -workspace iOS/iOS/#{name}.xcworkspace
             -scheme #{name}
             -destination platform='iOS Simulator',OS=latest,id='#{device}'
             clean test
             ", stdio: 'ignore'

    log 'Launching simulator'
    execSync "xcrun simctl launch #{device} #{getBundleId name}", stdio: 'ignore'

  catch {message}
    logErr message


getDeviceList = ->
  try
    exec 'xcrun instruments -s devices', true
      .toString()
      .split '\n'
      .filter (line) -> /^i/.test line
