[Github-comments] [geany/geany] Use lsof to get cwd of shell when /proc/pid/cwd isn't available (#436)

Colomban Wendling notifications at xxxxx
Sun Apr 28 08:59:17 UTC 2019


b4n requested changes on this pull request.

Looks good apart the comment, although I didn't actually test it on anything but my Linux :)

> @@ -675,6 +682,45 @@ const gchar *vte_get_working_directory(void)
 				g_free(cwd);
 			}
 		}
+		else
+		{
+			gint status = 0;
+			gchar *stdout = NULL;
+			gchar *pid_str = g_strdup_printf("%d", pid);
+			gchar *argv[] = {"lsof", "-a", "-d", "cwd", "-F", "n", "-p", pid_str, NULL};

Ideally you'd make this a `const gchar*` array, so that literals can be constant; and in the call below just cast up to `gchar**`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/436#pullrequestreview-231457053
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20190428/e68254d4/attachment.html>


More information about the Github-comments mailing list