Is it possible to run a "postwatch" script after a long-running "watch" script

Viewed 118

I have a project that uses a watch script to watch files and compile them as they change.

"scripts": {
    "watch": "node-sass ... -watch",
    "postwatch": "npm run clean:artifacts"
}

I am needing a way to run the postwatch script after the process is terminated so that I can clean up some artifacts created while watching. I understand that killing the watch process with CTRL + C terminates in a way that the watch command never really exits in the way that would trigger the postwatch script. I'm looking for alternatives.

Note: I've tried the following to no avail:

"watch": "node-sass ... -watch ; npm run postwatch",
0 Answers
Related