Re: where is error? (Glib::spawn_async)



Paul Pogonyshev wrote:
Hi.

Where is error in this code fragment?

      std::vector <std::string>  yelp_arguments;

      yelp_arguments.push_back ("yelp");
      yelp_arguments.push_back ("ghelp:///usr/share/gnome/help/gedit/C/gedit.xml");

      try
	{
	  Glib::spawn_async (".", yelp_arguments, std::vector <std::string> (),
			     Glib::SPAWN_SEARCH_PATH);
	  return;
	}
      catch (Glib::Error& exception)
	{
	  g_print ("%s...\n", exception.what ().c_str ());
	}

I get this in terminal:

    (yelp:14036): Gtk-WARNING **: cannot open display:

and Yelp window is never shown.

Paul
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list


The third argument you're passing to Glib::spawn_async(), std::vector<std::string>(), you shouldn't (and don't need to). It becomes the set of environment variables seen by the spawned child, instead of those already present in the parent process' environment. And while it may seem more secure or neater or something to change it, some variables are vital, e.g. without DISPLAY most Xlib-based programs won't work, and in GNOME's (and probably KDE's and other desktops) case there are several variables that allow session management and other desktop stuff to work properly. Non-GUI programs might also crap out, if they rely on e.g. HOME or USER (even though they shouldn't). Not sure but Mac OS X and probably Windows mightn't appreciate certain environment variables not being set properly ,either.



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