title: how to stop http-server on a specific port?
body: <p>I am using http-server in order to load <a href="http://localhost:8484" rel="nofollow noreferrer">http://localhost:8484</a> on a specific folder. (For testing purposes)
  the os commands I run in my code are: </p>
  
  <pre><code>http-server -p 8484 test/
  </code></pre>
  
  <p>and after I finish downloading whatever I run:</p>
  
  <pre><code>http-server stop
  </code></pre>
  
  <p>However, after the test is done, I see that the http-server with port 8484 is still alive!</p>
  
  <p>by running <code>ps aux | grep http</code> </p>
  
  <p>What command should I run in order to stop it?</p>
  
  <ul>
  <li>I am using Mac OSX (El Capitan version)</li>
  <li>I write the code in erlang (though I don't think it matters since I am running shell commands from the code).</li>
  <li>http-server: <a href="https://www.npmjs.com/package/http-server" rel="nofollow noreferrer">https://www.npmjs.com/package/http-server</a></li>
  </ul>
  
  <p>My code in erlang:</p>
  
  <pre><code>my_test_() -&gt;
    Pid = spawn(fun() -&gt;
            Info = os:cmd("http-server -p 8484 test/resources"),
            io:format(user,"*** Server: ~p~n",[Info])
          end),
  
  %%% Do some job %%%
  
    Pid2 = spawn(fun() -&gt;
             Info = os:cmd("http-server stop"),
             timer:sleep(200),
             io:format(user,"*** Server stop: ~p~n",[Info])
           end),
    timer:sleep(200),
    exit(Pid2, kill),
    exit(Pid, kill).
  </code></pre>