 path = require 'path'
 fs = require 'fs'
+util = require 'util'
 { spawn, exec } = require 'child_process'
 
 printLine = (line) -> process.stdout.write line + '\n'


  console.log "Watching #{restartFile} for timestamp changes."

module.exports =

  command: require './command'


    "iphone:run": ->

      copyTiappIfNeeded ->

        runAndWatch ->

          simulator = spawn titaniumPath(), [
            'run'
            '--platform=iphone'
          ]

          simulator.stdout.on 'data', printIt
          simulator.stderr.on 'data', printIt

          simulator.on 'exit', (code, signal) ->
            simulator.stdin.end()

          simulator
