forked from enlightenment/efl
New flag to allow forcing the use of /bin/sh to execute the command.
SVN revision: 21861
This commit is contained in:
parent
698513f861
commit
97d9523a28
|
@ -92,7 +92,8 @@ extern "C" {
|
||||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and delivered 1 event per line */
|
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and delivered 1 event per line */
|
||||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and delivered 1 event per line */
|
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and delivered 1 event per line */
|
||||||
ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
|
ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
|
||||||
ECORE_EXE_RESPAWN = 64 /**< FIXME: Exe is restarted if it dies */
|
ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
|
||||||
|
ECORE_EXE_USE_SH = 128 /**< Use /bin/sh to run the command. */
|
||||||
};
|
};
|
||||||
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
|
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ struct _ecore_exe_dead_exe
|
||||||
char *cmd;
|
char *cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void _ecore_exe_exec_it(const char *exe_cmd);
|
static inline void _ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags);
|
||||||
|
|
||||||
static int _ecore_exe_data_generic_handler(void *data,
|
static int _ecore_exe_data_generic_handler(void *data,
|
||||||
Ecore_Fd_Handler *
|
Ecore_Fd_Handler *
|
||||||
|
@ -228,7 +228,7 @@ ecore_exe_run(const char *exe_cmd, const void *data)
|
||||||
exes = _ecore_list2_append(exes, exe);
|
exes = _ecore_list2_append(exes, exe);
|
||||||
return exe;
|
return exe;
|
||||||
}
|
}
|
||||||
_ecore_exe_exec_it(exe_cmd);
|
_ecore_exe_exec_it(exe_cmd, 0);
|
||||||
exit(127);
|
exit(127);
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
|
@ -355,7 +355,7 @@ ecore_exe_pipe_run(const char *exe_cmd, Ecore_Exe_Flags flags, const void *data)
|
||||||
E_IF_NO_ERRNO(result, fcntl(statusPipe[1], F_SETFD, FD_CLOEXEC), ok) /* close on exec shows sucess */
|
E_IF_NO_ERRNO(result, fcntl(statusPipe[1], F_SETFD, FD_CLOEXEC), ok) /* close on exec shows sucess */
|
||||||
{
|
{
|
||||||
/* Run the actual command. */
|
/* Run the actual command. */
|
||||||
_ecore_exe_exec_it(exe_cmd); /* Should not return from this. */
|
_ecore_exe_exec_it(exe_cmd, flags); /* Should not return from this. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1147,7 +1147,7 @@ _ecore_exe_find(pid_t pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_ecore_exe_exec_it(const char *exe_cmd)
|
_ecore_exe_exec_it(const char *exe_cmd, Ecore_Exe_Flags flags)
|
||||||
{
|
{
|
||||||
char use_sh = 1;
|
char use_sh = 1;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
@ -1213,7 +1213,12 @@ _ecore_exe_exec_it(const char *exe_cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
setsid();
|
setsid();
|
||||||
if (use_sh)
|
if ((flags & ECORE_EXE_USE_SH))
|
||||||
|
{
|
||||||
|
errno = 0;
|
||||||
|
execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL);
|
||||||
|
}
|
||||||
|
else if (use_sh)
|
||||||
{ /* We have to use a shell to run this. */
|
{ /* We have to use a shell to run this. */
|
||||||
if (shell == NULL)
|
if (shell == NULL)
|
||||||
{ /* Find users preferred shell. */
|
{ /* Find users preferred shell. */
|
||||||
|
|
|
@ -157,7 +157,8 @@ enum _Ecore_Exe_Flags
|
||||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8,
|
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8,
|
||||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16,
|
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16,
|
||||||
ECORE_EXE_PIPE_AUTO = 32,
|
ECORE_EXE_PIPE_AUTO = 32,
|
||||||
ECORE_EXE_RESPAWN = 64
|
ECORE_EXE_RESPAWN = 64,
|
||||||
|
ECORE_EXE_USE_SH = 128
|
||||||
/* FIXME: Getting respawn to work
|
/* FIXME: Getting respawn to work
|
||||||
*
|
*
|
||||||
* There is no way that we can do anything about the internal state info of
|
* There is no way that we can do anything about the internal state info of
|
||||||
|
|
Loading…
Reference in New Issue