Created
May 18, 2018 09:34
-
-
Save barmic/c452326fdc0679af539c45b8cf869a38 to your computer and use it in GitHub Desktop.
Run idea
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
IDEA_SCRIPT=$(print -l /opt/idea-IU-*/bin/idea.sh | sort | tail -n1) | |
/usr/local/bin/reset-signal "${IDEA_SCRIPT}" &> /dev/null & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <signal.h> | |
int | |
main (int argc, char **argv) | |
{ | |
sigset_t sigs; | |
struct sigaction sa; | |
sigemptyset(&sigs); | |
sigaddset(&sigs, SIGINT); | |
sigaddset(&sigs, SIGTERM); | |
if (sigprocmask(SIG_UNBLOCK, &sigs, 0) != 0) { | |
fprintf(stderr, "sigprocmask failed\n"); | |
return 1; | |
} | |
memset(&sa, 0, sizeof(sa)); | |
sa.sa_handler = SIG_DFL; | |
if (sigaction(SIGINT, &sa, 0) != 0) { | |
fprintf(stderr, "sigaction failed for SIGINT\n"); | |
return 1; | |
} | |
memset(&sa, 0, sizeof(sa)); | |
sa.sa_handler = SIG_DFL; | |
if (sigaction(SIGTERM, &sa, 0) != 0) { | |
fprintf(stderr, "sigaction failed for SIGTERM\n"); | |
return 1; | |
} | |
if (argc <= 1) { | |
fprintf(stderr, "usage: %s <command> [args...]\n", argv[0]); | |
return 1; | |
} | |
execvp(argv[1], argv + 1); | |
fprintf(stderr, "execvp(...) failed\n"); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to Julia Beliaeva