 startStreamProcess = ->
   console.log "spawning picam"
   # ionice: -c1 (realtime) -n0 (highest priority)
-  picam = spawn 'nice', [
+  picam = child_process.spawn 'nice', [
     '-n', '-20', 'ionice', '-c1', '-n0', 'sudo', '-u', "##{PICAM_UID}",
     # picam command options
     PICAM_PATH, '--rtspout', '--alsadev', 'hw:1,0',

process.on 'SIGINT', ->
  console.log "Got SIGINT. Sending SIGINT to picam"
  if DO_SPAWN_PICAM and picam?
    picam.kill 'SIGINT'
  else
    process.kill process.pid, 'SIGTERM'


fs = require 'fs'
url = require 'url'
path = require 'path'
child_process = require 'child_process'

PICAM_UID = 1000
PICAM_CWD = path.normalize "#{__dirname}/.."
