Having a strange issue here with npm (on Windows, if it matters).
Chaining two commands with && works fine:
"test:integration": "firebase emulators:exec --non-interactive \"npm run test:integration:runner\" && kill-port 9000",
But if I substitute ; for && it fails to work:
"test:integration": "firebase emulators:exec --non-interactive \"npm run test:integration:runner\" ; kill-port 9000",
Instead of running the first command successfully, npm run test:integration just returns immediately if I use ;.
I want to run kill-port 9000 as cleanup after the first command, regardless of the exit status from the first command, which is why I switched to ;.
Any idea what's going on here? Is there an alternative way I can do this besides using ;?
(I did get it working by chanining && and || like (first_command && kill-port 9000) || kill-port 9000, but that seems hackish and I would like to understand why ; isn't working)
cmdby default. However on *nix (Linux, macOS, ...) it utilizesshas the default shell to run npm scripts. As you’re using Win, (essentially usingcmdwhen running npm scripts), then consider substituting the semicolon (;) with the AND operator, i.e. a single ampersand (&). Note: the AND operator incmd(&) has the same logic as the semicolon (;) inshon *nix - which is essentially execute command 2 regardless of whether command 1 fails or succeeds.&) has a different meaning/logic inshon *nix.