since: 2.40


g_subprocess_launcher_set_environ (
  GSubprocessLauncher* self,
  gchar** env


Replace the entire environment of processes launched from this launcher with the given ‘environ’ variable.

Typically you will build this variable by using g_listenv() to copy the process ‘environ’ and using the functions g_environ_setenv(), g_environ_unsetenv(), etc.

As an alternative, you can use g_subprocess_launcher_setenv(), g_subprocess_launcher_unsetenv(), etc.

Pass an empty array to set an empty environment. Pass NULL to inherit the parent process’ environment. As of GLib 2.54, the parent process’ environment will be copied when g_subprocess_launcher_set_environ() is called. Previously, it was copied when the subprocess was executed. This means the copied environment may now be modified (using g_subprocess_launcher_setenv(), etc.) before launching the subprocess.

On UNIX, all strings in this array can be arbitrary byte strings. On Windows, they should be in UTF-8.

Available since: 2.40



Type: An array of filename

the replacement environment.

The array must be NULL-terminated.
The data is owned by the caller of the method.
Each element is a file system path, using the OS encoding.