summaryrefslogtreecommitdiff
blob: 70231c7f0ab298ad47f5fafec74c67e904a438c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
function handle_signal($sig=null) {
	global $pidfile, $unlinkpidfile, $build, $task;
	if (isset($pidfile, $unlinkpidfile) && $unlinkpidfile)
		unlink($pidfile);
	if (isset($build)) {
		if (isset($task)) {
			$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->status='got_signal';
		$build->details=$sig;
		$build->write();
		debug("build $build->id given status $build->status");
	}
	debug("\nGot signal $sig - exiting");
	exit;
}
?>