mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
Fix linux ShowAlert process
This commit is contained in:
parent
dee7d7f7f9
commit
3c6d9b4fd9
2
doc.md
2
doc.md
@ -56,7 +56,7 @@
|
||||
##[Window](#Window)
|
||||
This is a work in progress.
|
||||
|
||||
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
|
||||
#####[ShowAlert](#ShowAlert)
|
||||
#####[CloseWindow](#CloseWindow)
|
||||
#####[IsValid](#IsValid)
|
||||
#####[SetActive](#SetActive)
|
||||
|
@ -59,7 +59,7 @@
|
||||
##[窗口](#Window)
|
||||
This is a work in progress.
|
||||
|
||||
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
|
||||
#####[ShowAlert](#ShowAlert)
|
||||
#####[CloseWindow](#CloseWindow)
|
||||
#####[IsValid](#IsValid)
|
||||
#####[SetActive](#SetActive)
|
||||
|
@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
version string = "v0.41.1.202,fate!"
|
||||
version string = "v0.41.1.204,fate!"
|
||||
)
|
||||
|
||||
//GetVersion get version
|
||||
|
@ -123,8 +123,9 @@ static int runTask(const char *taskname, char * const argv[], int *exit_status);
|
||||
|
||||
static int xmessage(char *argv[], int *exit_status)
|
||||
{
|
||||
static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
|
||||
"kmessage", "xmessage"};
|
||||
// static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
|
||||
// "kmessage", "xmessage"};
|
||||
static const char * const MSG_PROGS[] = {"xmessage"};
|
||||
static int PREV_MSG_INDEX = -1;
|
||||
#define MSG_PROGS_LEN (sizeof(MSG_PROGS) / sizeof(MSG_PROGS[0]))
|
||||
|
||||
@ -155,15 +156,18 @@ static int xmessage(char *argv[], int *exit_status)
|
||||
|
||||
static int runTask(const char *taskname, char * const argv[], int *exit_status)
|
||||
{
|
||||
pid_t pid;
|
||||
pid_t pid = fork();
|
||||
int status;
|
||||
|
||||
switch (pid = fork()) {
|
||||
switch (pid) {
|
||||
case -1: /* Failed to fork */
|
||||
perror("fork");
|
||||
return FORK_FAILED; /* Failed to fork. */
|
||||
case 0: /* Child process */
|
||||
execvp(taskname, argv);
|
||||
if (strcmp(argv[0],"xmessage") == 0){
|
||||
execvp(taskname, argv);
|
||||
perror("execvp failed");
|
||||
}
|
||||
exit(42); /* Failed to run task. */
|
||||
default: /* Parent process */
|
||||
wait(&status); /* Block execution until finished. */
|
||||
|
Loading…
Reference in New Issue
Block a user