After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 565037 - Add magic 'restart' command to run dialog which re-executes
Add magic 'restart' command to run dialog which re-executes
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2008-12-18 19:57 UTC by Colin Walters
Modified: 2008-12-18 20:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add magic 'restart' command to run dialog which re-executes (2.28 KB, patch)
2008-12-18 19:57 UTC, Colin Walters
accepted-commit_now Details | Review

Description Colin Walters 2008-12-18 19:57:00 UTC
Extremely convenient for debugging.
Comment 1 Colin Walters 2008-12-18 19:57:03 UTC
Created attachment 124953 [details] [review]
Add magic 'restart' command to run dialog which re-executes

This is immensely convenient for debugging.  The shell global reexec_self
only works on Linux, sue me.
Comment 2 Owen Taylor 2008-12-18 20:06:11 UTC
Looks useful. Small comments:

+/**
+ * Restart the current process.  Only intended for development purposes.
+ */

Not quite a doc comment, think it's easier if we stick to writing real doc-comment formatted doc comments - could easily imagine someone cut-and-pasting and adding an annotation and being puzzled by why it didn't work.

Would like to see a comment that it is linux only.

+  if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, NULL))
+    return;

Think it's worth the couple of lines to g_warning() error.message if this fails.

+  for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1) {
+    g_ptr_array_add (arr, buf_p);
+  }

Needs identation fix (or just remove the '{}')

Needs to be commented that a) /proc/self/cmdnline is \0 separated. b) g_file_ge_contents adds a trailing \0.

+  g_ptr_array_add (arr, NULL); 
+  execvp (arr->pdata[0], arr->pdata);

Would add:

   g_warning("Re-execing gnome-shell failed: %s", g_strerror());
   /* If exec fails, we leak the array */
Comment 3 Colin Walters 2008-12-18 20:58:09 UTC
Thanks, fixed up for all the comments.

Just remember it's "restart" and not "reboot".

Committed r130
	M	src/shell-global.c
	M	src/shell-global.h
	M	js/ui/runDialog.js
r130 = ab9a36d570abd6f74b77e97face0aed2c8f15002 (git-svn)