summaryrefslogtreecommitdiff
blob: 2a895e5c44c8d18d3c492cb2fcbfa67d231fc615 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?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=$sig;
		$build->write();
		debug("build $build->id given status $build->status");
	}
	debug("\nGot signal $sig - exiting");
	exit;
}
?>