How to exit a process gracefully from windows. Preferrably via GITBASH

40 views Asked by At

I am in windows and have a java program with shutdownhook. When i run it as a jar in a cmd and press ctr c (interrupt signal), the shutdown gets invoked correctly. On the other hand when i try to kill this command gracefully using kill -15 processId or kill -TERM processId, this shutdownhook is not invoked, but the application is terminated. (Used gitbash in windows OS for this.)

On further searching read that the kill -15 processId and kill -TERM processId might behave differently in windows.

Is there any way we can invoke kill -15 processId or kill -TERM processId or any other command to close a process gracefully based on processId from windows, if possible via gitbash.

0

There are 0 answers