GNOME Bugzilla – Bug 565037
Add magic 'restart' command to run dialog which re-executes
Last modified: 2008-12-18 20:58:09 UTC
Extremely convenient for debugging.
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.
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 */
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)