kill - terminate or send a signal to a process


<kill $pid [$sig]>

To each process id in $pid, the kill function sends the signal in the corresponding value of $sig. If fewer values of $sig are present than $pid, the last is re-used; if none are given, SIGTERM (15) is used. Signals may be given as numbers or names (e.g. "SIGHUP" and 1 are generally equivalent).

It is generally advisable to use the default or SIGTERM signal first when killing a process, so that it has a chance to clean up and potentially avoid corruption issues. Only after SIGTERM fails and several seconds have passed should a hard SIGKILL be used.

The kill function returns 1 if the call succeeds, 0 if not. In version 3.01.983500000 20010301 and earlier, nothing is returned.

The kill function was added in version 2.1.900900000 19980720.

For Windows, version 5.01.1171938352 20070219 and later map signal 0 to procexists, SIGINT/SIGBREAK to a Ctrl-Break event, and SIGTERM to a Texis Terminate event (soft kill, works with most Texis processes only). All other signals are mapped to TerminateProcess, which is a "hard" kill of a process and should only be used as a last resort. Prior to Windows version 5.01.1171938352 20070219, all signals mapped to TerminateProcess. Prior to Windows version 3.01.983500000 20010301, the kill function had no effect. Use the procexists function instead of <kill $pid 0> to test for the existence of a process.

getpid, procexists

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.