BrowserSync / browser-sync

Keep multiple browsers & devices in sync when building websites. https://browsersync.io
https://discord.gg/2d2xUThp
Apache License 2.0
12.17k stars 756 forks source link

Kill BrowserSync from UI #1415

Open equiman opened 7 years ago

equiman commented 7 years ago

Issue details

On windows if you close the window automatically the web browser close too. But on macOS if you close the terminal window instead of ctrl+c the process continuos running. I'm trying to kill it but cant found the way:

If you run again BS create another instance with a new port. But what I need is close all the opened servers and run a new one.

Even I try with this solution, but always say active = false https://stackoverflow.com/questions/38231359/how-do-i-kill-browsersync-before-creating-it

I think a solution is add an option to kill the server directly from UI option.

Steps to reproduce/test case

  1. Run browserSync on mac
  2. Close terminal from X option
  3. Run this command netstat -at | grep LISTEN | grep *.http and you can see the web server still running.

Please specify which version of Browsersync, node and npm you're running

Affected platforms

Browsersync use-case

for all other use-cases, (gulp, grunt etc), please show us exactly how you're using Browsersync

const jsonPlaceholderProxy = proxyMiddleware(args.pc, {
        target: args.pt,
        secure: false,
        changeOrigin: true
    });

    browserSync.init({
        host: (args.host || ''),
        port: args.port,
        notify: false,
        cors: true,
        https: args.ptc,
        browser: args.osb,
        open: 'local',
        startPath: args.ipt,
        server: {
            middleware: [jsonPlaceholderProxy],
            baseDir: (args.pth),
            directory: true
        }
    });
davidwebca commented 3 years ago

This still happens to me once in a while, however not all the time. I've not been able to pin down how. Maybe adding a kill switch from the UI would be nice.