summaryrefslogtreecommitdiff
blob: 62f5fe3a53ba6ed5aee36d093e6c908618bcd56f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
function handle_signal($sig=null) {
	global $pidfile, $unlinkpidfile, $build, $task;
	if (isset($pidfile, $unlinkpidfile) && $unlinkpidfile)
		unlink($pidfile);
	if (isset($build)) {
		if (isset($task)) {
			log_msg("\nGot signal $sig\n");
			$task->finish=time();
			$task->exit=-$sig;
			$task->write();
			debug("build $build->id task $task->order given exit status -$sig");
		} else {
			debug('$task not set');
		}
		$build->finish=time();
		$build->write();
	}
	debug("\nGot signal $sig - exiting");
	exit;
}
?>