code: private void prepareCommand(final TaskInfo.Builder bldr, final SingularityTaskId taskId, final SingularityTaskRequest task, final SingularityOfferHolder offerHolder, final Optional<long[]> ports) {
      CommandInfo.Builder commandBldr = CommandInfo.newBuilder();
  
      Optional<String> specifiedUser = task.getPendingTask().getRunAsUserOverride().or(task.getDeploy().getUser());
      if (specifiedUser.isPresent()) {
        commandBldr.setUser(specifiedUser.get());
      }
  
      if (task.getDeploy().getCommand().isPresent()) {
        commandBldr.setValue(task.getDeploy().getCommand().get());
      }
  
      if (task.getDeploy().getArguments().isPresent()) {
        commandBldr.addAllArguments(task.getDeploy().getArguments().get());
      }
  
      if (task.getPendingTask().getCmdLineArgsList().isPresent()) {
        commandBldr.addAllArguments(task.getPendingTask().getCmdLineArgsList().get());
      }
  
      if (task.getDeploy().getShell().isPresent()){
        commandBldr.setShell(task.getDeploy().getShell().get());
      } else if ((task.getDeploy().getArguments().isPresent() && !task.getDeploy().getArguments().get().isEmpty()) ||
          // Hopefully temporary workaround for
          // http://www.mail-archive.com/user@mesos.apache.org/msg01449.html
          task.getDeploy().getContainerInfo().isPresent() ||
          (task.getPendingTask().getCmdLineArgsList().isPresent() && !task.getPendingTask().getCmdLineArgsList().get().isEmpty())) {
        commandBldr.setShell(false);
      }
  
      List<SingularityMesosArtifact> combinedArtifacts = new ArrayList<>();
      combinedArtifacts.addAll(task.getDeploy().getUris().or(Collections.emptyList()));
      combinedArtifacts.addAll(task.getPendingTask().getExtraArtifacts());
  
      prepareMesosUriDownloads(combinedArtifacts, commandBldr);
  
      prepareEnvironment(task, taskId, commandBldr, offerHolder, ports);
  
      bldr.setCommand(commandBldr);
    }
docs: Prepares the Mesos TaskInfo object when using the Mesos Default Executor.