portalHelper: Stop using non-default ARGV vector
If gjs itself defines ARGV, it only holds the arguments that are passed on to the script, and javascript code should combine the programName and ARGV (or the newer programArgs) when it needs a C-style argv array. Do the same in the portal-helper process instead of passing along the original C argv, to avoid confusion when accessing the arguments from javascript. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2786>
This commit is contained in:
parent
80ac32a268
commit
38c9364acc
@ -18,23 +18,16 @@ main (int argc, char *argv[])
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
context = g_object_new (GJS_TYPE_CONTEXT,
|
||||
"program-name", *argv,
|
||||
"search-path", search_path,
|
||||
NULL);
|
||||
|
||||
if (!gjs_context_define_string_array(context, "ARGV",
|
||||
argc, (const char**)argv,
|
||||
&error))
|
||||
{
|
||||
g_message("Failed to define ARGV: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (context);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
gjs_context_set_argv(context, argc - 1, (const char**)argv + 1);
|
||||
|
||||
if (!gjs_context_eval (context,
|
||||
"const Main = imports.portalHelper.main; Main.main(ARGV);",
|
||||
"const Main = imports.portalHelper.main;"
|
||||
"const {programInvocationName, programArgs} = imports.system;"
|
||||
"Main.main([programInvocationName, ...programArgs]);",
|
||||
-1,
|
||||
"<main>",
|
||||
&status,
|
||||
|
Loading…
Reference in New Issue
Block a user