Fossil

Diff
Login

Differences From Artifact [15f68d2a6a]:

To Artifact [21da6c2f3b]:


368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

/*
** A cross-platform "spawn" type function: search for zProgram in PATH,
** passing the given argument list through without interpretation.  Due
** to Windows platform limitations — see the definition of WinMain() —
** this is an ideal we can achieve only on POSIX platforms.
*/
int fossil_spawn(const char* zProgram, char* const azArgv[])
{
  extern char **environ;
  int status = -1;
  pid_t pid;
  if(posix_spawnp(&pid, zProgram, NULL, NULL, azArgv, environ)==0){
    waitpid(pid, &status, 0);
  }else{







|







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

/*
** A cross-platform "spawn" type function: search for zProgram in PATH,
** passing the given argument list through without interpretation.  Due
** to Windows platform limitations — see the definition of WinMain() —
** this is an ideal we can achieve only on POSIX platforms.
*/
int fossil_spawn(const char* zProgram, char * const azArgv[])
{
  extern char **environ;
  int status = -1;
  pid_t pid;
  if(posix_spawnp(&pid, zProgram, NULL, NULL, azArgv, environ)==0){
    waitpid(pid, &status, 0);
  }else{
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
**
** To an outsider, this function has the same effect as test-echo,
** but the way it achieves that exercises a different subset of
** Fossil's functionality.
*/
void test_fossil_spawn_cmd(void){
  int i, j=0;
  char** azArgv = fossil_malloc(sizeof(char*) * (g.argc + 1));
  azArgv[j++] = g.nameOfExe;
  azArgv[j++] = "test-echo";
  if( find_option("hex",0,0) ){
    azArgv[j++] = "--hex";
  }
  for( i=2; i<g.argc; ++i ){
    azArgv[j++] = g.argv[i];







|







395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
**
** To an outsider, this function has the same effect as test-echo,
** but the way it achieves that exercises a different subset of
** Fossil's functionality.
*/
void test_fossil_spawn_cmd(void){
  int i, j=0;
  char **azArgv = fossil_malloc(sizeof(char*) * (g.argc + 1));
  azArgv[j++] = g.nameOfExe;
  azArgv[j++] = "test-echo";
  if( find_option("hex",0,0) ){
    azArgv[j++] = "--hex";
  }
  for( i=2; i<g.argc; ++i ){
    azArgv[j++] = g.argv[i];