[INTERPRETER]
* NEW: System.Shell is a new property that allows to define the shell used by the Shell instruction. By default, this is '/bin/sh'. git-svn-id: svn://localhost/gambas/trunk@4453 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
b9b2d298a4
commit
1a6d492738
4 changed files with 24 additions and 11 deletions
|
@ -1431,19 +1431,9 @@ bool GB_ExistFile(const char *path)
|
|||
void GB_Store(GB_TYPE type, GB_VALUE *src, void *dst)
|
||||
{
|
||||
if (src != NULL)
|
||||
{
|
||||
/* Ne marche que parce que value->type == type apr<70> un VALUE_read()
|
||||
Sinon il y'aurait des probl<EFBFBD>es de r<EFBFBD><EFBFBD>ences - VALUE_write faisant
|
||||
appel <EFBFBD>VALUE_conv() (ceci est un ancien commentaire)
|
||||
|
||||
=> src->type doit <EFBFBD>re <EFBFBD>al <EFBFBD>type
|
||||
*/
|
||||
VALUE_write((VALUE *)src, dst, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
VALUE_free(dst, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,6 +63,8 @@
|
|||
|
||||
//#define DEBUG_ME
|
||||
|
||||
char *CPROCESS_shell = NULL;
|
||||
|
||||
extern char **environ;
|
||||
|
||||
DECLARE_EVENT(EVENT_Read);
|
||||
|
@ -355,7 +357,7 @@ static void init_child_tty(int fd)
|
|||
|
||||
static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
|
||||
{
|
||||
static const char *shell[] = { "sh", "-c", NULL, NULL };
|
||||
static const char *shell[] = { "/bin/sh", "-c", NULL, NULL };
|
||||
|
||||
int fdin[2], fdout[2], fderr[2];
|
||||
pid_t pid;
|
||||
|
@ -382,6 +384,9 @@ static void run_process(CPROCESS *process, int mode, void *cmd, CARRAY *env)
|
|||
|
||||
argv = (char **)shell;
|
||||
|
||||
if (CPROCESS_shell)
|
||||
argv[0] = CPROCESS_shell;
|
||||
|
||||
argv[2] = (char *)cmd;
|
||||
|
||||
if (argv[2] == NULL || *argv[2] == 0)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#ifndef __GBX_C_PROCESS_C
|
||||
extern GB_DESC NATIVE_Process[];
|
||||
extern char *CPROCESS_shell;
|
||||
#else
|
||||
|
||||
#define THIS ((CPROCESS *)_object)
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "gbx_extern.h"
|
||||
#include "gbx_object.h"
|
||||
|
||||
#include "gbx_c_process.h"
|
||||
#include "gbx_c_system.h"
|
||||
|
||||
BEGIN_PROPERTY(User_Home)
|
||||
|
@ -184,6 +185,21 @@ BEGIN_METHOD(System_GetExternSymbol, GB_STRING library; GB_STRING name)
|
|||
|
||||
END_METHOD
|
||||
|
||||
|
||||
BEGIN_PROPERTY(System_Shell)
|
||||
|
||||
if (READ_PROPERTY)
|
||||
{
|
||||
if (!CPROCESS_shell)
|
||||
GB_ReturnConstZeroString("/bin/sh");
|
||||
else
|
||||
GB_ReturnString(CPROCESS_shell);
|
||||
}
|
||||
else
|
||||
GB_StoreString(PROP(GB_STRING), &CPROCESS_shell);
|
||||
|
||||
END_PROPERTY
|
||||
|
||||
#endif
|
||||
|
||||
GB_DESC NATIVE_User[] =
|
||||
|
@ -209,6 +225,7 @@ GB_DESC NATIVE_System[] =
|
|||
|
||||
GB_STATIC_PROPERTY("Language", "s", System_Language),
|
||||
GB_STATIC_PROPERTY("FirstDayOfWeek", "i", System_FirstDayOfWeek),
|
||||
GB_STATIC_PROPERTY("Shell", "s", System_Shell),
|
||||
GB_STATIC_PROPERTY_READ("RightToLeft", "b", System_RightToLeft),
|
||||
GB_STATIC_PROPERTY_READ("Charset", "s", System_Charset),
|
||||
GB_STATIC_PROPERTY_READ("Host", "s", System_Host),
|
||||
|
|
Loading…
Reference in a new issue