debug_test 910 bytes
#!/bin/bash

do_kill()
{
  local pid=$1
  if [[ -n $pid ]]; then
    if [[ -n $(ps -ef|grep $pid|grep -v grep) ]]; then
      echo "killing $pid..."
      kill $jm_pid
    else
      echo "no process with pid $pid"
    fi
  fi
}

do_exit()
{
#   echo "exits"
   do_kill $jm_pid
}

syntax()
{
  echo "syntaxe : $(basename $0) <fichier spec>"
  exit 1
}

trap do_exit SIGINT
trap do_exit EXIT

if [[ $# != 1 ]]; then
  syntax
fi

ni=$(ps -ef|grep node-inspector|grep -v grep)
if [[ -z $ni ]]; then
  echo "starting node-inspector..."
  node-inspector &
else
  echo "node-inspector already running"
fi
echo

echo "debugging $1..."
node --debug-brk ./node_modules/jasmine-node/bin/jasmine-node $1 &
jm_pid=$!
echo

#ps -ef|grep jasmine-node|grep -v grep
#pid=$(ps -ef|grep jasmine-node|grep -v grep|awk '{print $2}')
#echo $pid $jm_pid

echo "starting Chrome...."
chromium-browser http://127.0.0.1:8080/?port=5858