8 #define SPAWN_BUFSIZE 128
10 gboolean spawn_sync(char **argv,char **standard_output,int *exit_status)
12 /* Don't use g_spawn_sync on WIN32 for now to avoid needing the helper */
17 GSpawnFlags flags=G_SPAWN_SEARCH_PATH;
19 flags=G_SPAWN_STDOUT_TO_DEV_NULL;
20 retval=g_spawn_sync(NULL,argv,NULL,flags,NULL,NULL,standard_output,
21 &standard_error,exit_status,&error);
22 fputs(standard_error,stderr);
23 g_free(standard_error);
26 fprintf(stderr,"%s\n",error->message);
30 *exit_status=WEXITSTATUS(*exit_status);
36 GString *command_line,*string;
37 command_line=g_string_new(NULL);
41 g_string_append_c(command_line,' ');
42 g_string_append(command_line,argv[i]);
44 fp=popen(command_line->str,"r");
45 g_string_free(command_line,TRUE);
48 perror(command_line->str);
51 string=g_string_new(NULL);
55 g_string_set_size(string,len+SPAWN_BUFSIZE);
56 n=fread(string->str+len,1,SPAWN_BUFSIZE,fp);
61 g_string_free(string,TRUE);
64 g_string_set_size(string,len+n);
70 g_string_free(string,TRUE);
78 *standard_output=g_string_free(string,FALSE);
80 g_string_free(string,TRUE);