private void setcs(String viewTag, String viewPath, SetcsOption option, String configSpec)
      throws IOException, InterruptedException {
    if (option == SetcsOption.CONFIGSPEC) {
      Validate.notNull(
          configSpec, "Using option CONFIGSPEC, you must provide a non-null config spec");
    } else {
      Validate.isTrue(
          configSpec == null, "Not using option CONFIGSPEC, you must provide a null config spec");
    }
    ArgumentListBuilder cmd = new ArgumentListBuilder();
    cmd.add("setcs");
    if (viewTag != null) {
      cmd.add("-tag");
      cmd.add(viewTag);
    }
    String optionStr = getOption(option);
    if (optionStr != null) {
      cmd.add(optionStr);
    }
    FilePath configSpecFile = null;
    if (option == SetcsOption.CONFIGSPEC) {
      configSpecFile = launcher.getWorkspace().createTextTempFile("configspec", ".txt", configSpec);
      cmd.add(
          PathUtil.convertPathForOS(
              configSpecFile.absolutize().getRemote(), launcher.getLauncher().isUnix()));
    }
    FilePath workingDirectory = null;
    if (viewPath != null) {
      workingDirectory = new FilePath(getRootViewPath(launcher), viewPath);
    }
    String output =
        runAndProcessOutput(
            cmd, new ByteArrayInputStream("yes".getBytes()), workingDirectory, false, null);
    if (configSpecFile != null) {
      configSpecFile.delete();
    }

    if (output.contains("cleartool: Warning: An update is already in progress for view")) {
      throw new IOException("View update failed: " + output);
    }
  }