code: @WorkerThread
    public static Process runWithEnv(@NonNull String command, Map<String, String> environment) throws IOException {
      String[] env;
      if (environment != null && environment.size() != 0) {
        Map<String, String> newEnvironment = new HashMap<>();
        newEnvironment.putAll(System.getenv());
        newEnvironment.putAll(environment);
        int i = 0;
        env = new String[newEnvironment.size()];
        for (Map.Entry<String, String> entry : newEnvironment.entrySet()) {
          env[i] = entry.getKey() + "=" + entry.getValue();
          i++;
        }
      } else {
        env = null;
      }
      return Runtime.getRuntime().exec(command, env);
    }
docs: <p>This code is adapted from java.lang.ProcessBuilder.start().</p>
  
  <p>The problem is that Android doesn't allow us to modify the map returned by ProcessBuilder.environment(), even
  though the JavaDoc indicates that it should. This is because it simply returns the SystemEnvironment object that
  System.getenv() gives us. The relevant portion in the source code is marked as "// android changed", so
  presumably it's not the case in the original version of the Apache Harmony project.</p>
  
  @param command
  The name of the program to execute. E.g. "su" or "sh".
  @param environment
  Map of all environment variables
  @return new {@link Process} instance.
  @throws IOException
  if the requested program could not be executed.