Sha256: 53756df33d9012aa71887555c53bed6c33bb31a9f8b7412632729bd6744b9dc1

Contents?: true

Size: 764 Bytes

Versions: 8

Compression:

Stored size: 764 Bytes

Contents

/*
 * Copyright (C) the libgit2 contributors. All rights reserved.
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */

#include <stdint.h>
#include <signal.h>
#include "git2_util.h"
#include "cli.h"

static void (*interrupt_handler)(void) = NULL;

static void interrupt_proxy(int signal)
{
	GIT_UNUSED(signal);
	interrupt_handler();
}

int cli_sighandler_set_interrupt(void (*handler)(void))
{
	void (*result)(int);

	if ((interrupt_handler = handler) != NULL)
		result = signal(SIGINT, interrupt_proxy);
	else
		result = signal(SIGINT, SIG_DFL);

	if (result == SIG_ERR) {
		git_error_set(GIT_ERROR_OS, "could not set signal handler");
		return -1;
	}

	return 0;
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rugged-1.7.2 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.6.5 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.7.1 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.6.3 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.6.2 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.5.1 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.5.0.1 vendor/libgit2/src/cli/unix/sighandler.c
rugged-1.5.0 vendor/libgit2/src/cli/unix/sighandler.c