Question

I followed the Symfony2 guide to automatically dump assetic files in dev mode:

  • I changed the use_controller parameter to false in my dev config file.
  • And I started the --watch routine.

    $ php app/console assetic:dump --watch
    

How can I stop watching?

Was it helpful?

Solution

Command looking for file changes only while it working itself. So then you stop command - no more automatic regenerating assets.

On linux its typical ctrl+c or ctrl+x

P.S. some code from DumpCommand

while (true) {
    try {
        foreach ($this->am->getNames() as $name) {
            if ($this->checkAsset($name, $previously)) {
                $this->dumpAsset($name, $output);
            }
        }

        // reset the asset manager
        $prop->setValue($this->am, array());
        $this->am->load();

        file_put_contents($cache, serialize($previously));
        $error = '';
    } catch (\Exception $e) {
        if ($error != $msg = $e->getMessage()) {
            $output->writeln('<error>[error]</error> '.$msg);
            $error = $msg;
        }
    }
    sleep($input->getOption('period'));
}

OTHER TIPS

Like @forgottenbas points out the code runs in an infinite loop so it's not really a background worker but simply a worker that occupies your shell until an outside force intervenes.

Generally the developer can kill the process or the shell session it's occupying.

On OSX ctrl + c sends SIGKILL, for instance.

In Windows it seems to work a bit differently in Window shells: http://en.wikipedia.org/wiki/Kill_(command)#Microsoft_Windows

It's definitely OS, or more accurately, shell dependent.

If you have spawned a linux background process, e.g.:

$ php app/console assetic:dump --watch &

you have to kill the php process that is running

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top