Re: Help on g_spwan_async




 Thanks to Bill Nolean and Torri for the reply --

 Torri, you were right on the money!! -- a copy and paste from shell_parse_argv
and the async call messed up the param the way you described.

 Bill, the backslash "\" was not causing problems becuase I was not
initializeng the char* the way I described  ( The pointer was set with
g_build_path.and not with char* str = "some\dir")


 Torri, I have changed the code to delete the dir myself (recursively). This
way, the darn console window does not popup (The only disadivantage is that it
will block your app for a while when deleting a lot of dir.-- this can be
easily bypassed if once uses thread to do the job -- I just avoinded using
threads out of lazyness :P)

  Let me know if you want my code to use in your app.

 Again, thanks for all the help and reply.



--- TORRI Vincent <Vincent Torri math u-bordeaux fr> wrote:
On Tue, 19 Nov 2002, Harring Figueiredo wrote:

 
Folks,

 I have the following code:

    exe_string = g_strdup_printf("%s %s", rm_cmd, path);
    g_print("Executing command: %s\n", exe_string);
    if ( g_shell_parse_argv(exe_string ,&i, &exe_cmd , &error) != TRUE) {
        *err = g_strdup(error->message);
        g_error_free(error);
        return FALSE;
    }
    ret_val = g_spawn_async_with_pipes(NULL, exe_cmd ,NULL,
            G_SPAWN_LEAVE_DESCRIPTORS_OPEN | G_SPAWN_SEARCH_PATH,
            NULL, NULL, &pid, NULL, NULL, NULL, &error);

I have the "same" problem yesterday : the DOS console appears, disappears 
and nothing appends (a test with treeview). I search the line and it was a 
problem of wrong type in a function. Perhaps you have to use &exe_cmd in 
g_spawn_async_with_pipes (2nd parameter) as it requests a gchar **.

regards

Vincent TORRI


  rm_cmd = "deltree /Y" and path= "I:\somepath\somedir"

 When I run the command on windowze, I can see the DOS console windows
poping
up and desapearing; however, the directory never gets deleted.

  IF I do an exact copy andpaty of the command that I output with g_print
above, the directory gets deleted.

  What am I doing wrong here ? 


NOTE: I am using this code because I need to delete anentire directory
structure on Windows and the remove() calls is only working for files -- I
guess it has a bug reported on the remove(3) man pages.
If anyone has a better suggestion that the code above, please drop me a
line.


Note 2: compiled with mingwin gcc 2.95.3 (Windows binary from Tor's site.)



Thanks for any help.

Harring.

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


-- 
TORRI Vincent
Mathematiques Appliquees Bordeaux                                            
   
Institut de Mathematiques                                                    
  
Universite Bordeaux 1                                                        
  
351 cours de la liberation                                                   
  
33 405 Talence cedex - France                                                
  
                                                                             
  
Tel : 33 (0)5 57 96 21 42                                                    
  
Fax : 33 (0)5 56 84 26 26                                                    
  
--



__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]