* @param options
   * @return StringWrapper
   */
  public static StringWrapper shellCommand(Stella_Object command, Cons options) {
    if (((Boolean)(OntosaurusUtil.$BLOCK_SHELL_COMMANDp$.get())).booleanValue()) {
      throw ((StellaException)(StellaException.newStellaException("Execution of `shell-command' is blocked in this context").fillInStackTrace()));
    }
    { PropertyList theoptions = Logic.parseLogicCommandOptions(options, Cons.list$(Cons.cons(OntosaurusUtil.KWD_DIRECTORY, Cons.cons(OntosaurusUtil.SGT_STELLA_STRING, Cons.cons(OntosaurusUtil.KWD_INPUT, Cons.cons(OntosaurusUtil.SGT_STELLA_STRING, Cons.cons(Stella.NIL, Stella.NIL)))))), true, false);
      String directory = StringWrapper.unwrapString(((StringWrapper)(theoptions.lookup(OntosaurusUtil.KWD_DIRECTORY))));
      String inputstring = StringWrapper.unwrapString(((StringWrapper)(theoptions.lookup(OntosaurusUtil.KWD_INPUT))));
      InputStringStream inputstream = ((!Stella.blankStringP(inputstring)) ? InputStringStream.newInputStringStream(inputstring) : ((InputStringStream)(null)));
      OutputStringStream outputstream = OutputStringStream.newOutputStringStream();
      OutputStringStream errorstream = OutputStringStream.newOutputStringStream();
      int exit = OntosaurusUtil.executeShellCommand(command, directory, inputstream, outputstream, errorstream);
      String output = outputstream.theStringReader();
      String error = errorstream.theStringReader();

      if (inputstream != null) {
        Stream.closeStream(inputstream);
      }
      Stream.closeStream(outputstream);
      Stream.closeStream(errorstream);
      if (!Stella.blankStringP(error)) {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("shell-command: `" + error + "'");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
      if (!(exit == 0)) {
        { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

          stream001.nativeStream.print("shell-command: non-zero exit status=`" + exit + "'");
          throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
        }
      }
      if (Stella.blankStringP(output)) {
        return (null);
      }
      else {
        return (StringWrapper.wrapString(output));
      }
    }
  }