jnr.posix.POSIX.isatty()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(163)

本文整理了Java中jnr.posix.POSIX.isatty()方法的一些代码示例,展示了POSIX.isatty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.isatty()方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:isatty

POSIX.isatty介绍

暂无

代码示例

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

public boolean isatty(FileDescriptor descriptor) {
  try { return posix.isatty(descriptor); } catch (UnsatisfiedLinkError ule) { return unimplementedBool(); }
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

public boolean isatty(FileDescriptor descriptor) {
  return posix().isatty(descriptor);
}

代码示例来源:origin: com.github.jnr/jnr-posix

public boolean isatty(FileDescriptor descriptor) {
  return posix().isatty(descriptor);
}

代码示例来源:origin: com.github.jnr/jnr-posix

public boolean isatty(FileDescriptor descriptor) {
  try { return posix.isatty(descriptor); } catch (UnsatisfiedLinkError ule) { return unimplementedBool(); }
}

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

public boolean isatty(FileDescriptor descriptor) {
  try { return posix.isatty(descriptor); } catch (UnsatisfiedLinkError ule) { return unimplementedBool(); }
}

代码示例来源:origin: com.github.jnr/jnr-posix

public int isatty(int descriptor) {
  return posix().isatty(descriptor);
}

代码示例来源:origin: com.github.jnr/jnr-posix

public int isatty(int descriptor) {
  try { return posix.isatty(descriptor); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

public boolean isatty(FileDescriptor descriptor) {
  try { return posix.isatty(descriptor); } catch (UnsatisfiedLinkError ule) { return unimplementedBool(); }
}

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

public boolean isatty(FileDescriptor descriptor) {
  return posix().isatty(descriptor);
}

代码示例来源:origin: org.python/jython

@Override
public boolean isatty() {
  checkClosed();
  if (file == null || fileOutputStream == null) {
    return false;
  }
  try {
    return PosixModule.getPOSIX().isatty(file != null
                       ? file.getFD() : fileOutputStream.getFD());
  } catch (IOException e) {
    return false;
  }
}

代码示例来源:origin: org.jruby/jruby-core

public static void dumpBacktrace(RubyException exception) {
  Ruby runtime = exception.getRuntime();
  System.err.println("Backtrace generated:\n" + printBacktraceJRuby(exception, runtime.getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: org.jruby/jruby-complete

public static void dumpBacktrace(RubyException exception) {
  Ruby runtime = exception.getRuntime();
  System.err.println("Backtrace generated:\n" + printBacktraceJRuby(exception, runtime.getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

/** Prints an error with backtrace to the error stream.
 *
 * MRI: eval.c - error_print()
 *
 */
public void printError(RubyException excp) {
  if (excp == null || excp.isNil()) {
    return;
  }
  PrintStream errorStream = getErrorStream();
  errorStream.print(config.getTraceType().printBacktrace(excp, errorStream == System.err && getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** Prints an error with backtrace to the error stream.
 *
 * MRI: eval.c - error_print()
 *
 */
public void printError(RubyException excp) {
  if (excp == null || excp.isNil()) {
    return;
  }
  PrintStream errorStream = getErrorStream();
  errorStream.print(config.getTraceType().printBacktrace(excp, errorStream == System.err && getPosix().isatty(FileDescriptor.err)));
}

代码示例来源:origin: org.python/jython

@Override
public boolean isatty() {
  checkClosed();
  FileDescriptor fd;
  try {
    if ((fd = getInputFileDescriptor(inputStream)) == null
      && (fd = getOutputFileDescriptor(outputStream)) == null) {
      return false;
    }
  } catch (IOException e) {
    return false;
  }
  return PosixModule.getPOSIX().isatty(fd);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

protected void warnCircularRequire(String requireName) {
  runtime.getWarnings().warn("loading in progress, circular require considered harmful - " + requireName);
  // it's a hack for c:rb_backtrace impl.
  // We should introduce new method to Ruby.TraceType when rb_backtrace is widely used not only for this purpose.
  RaiseException ex = new RaiseException(runtime, runtime.getRuntimeError(), null, false);
  String trace = runtime.getInstanceConfig().getTraceType().printBacktrace(ex.getException(), runtime.getPosix().isatty(FileDescriptor.err));
  // rb_backtrace dumps to stderr directly.
  System.err.print(trace.replaceFirst("[^\n]*\n", ""));
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

protected void warnCircularRequire(String requireName) {
  runtime.getWarnings().warn("loading in progress, circular require considered harmful - " + requireName);
  // it's a hack for c:rb_backtrace impl.
  // We should introduce new method to Ruby.TraceType when rb_backtrace is widely used not only for this purpose.
  RaiseException ex = new RaiseException(runtime, runtime.getRuntimeError(), null, false);
  String trace = runtime.getInstanceConfig().getTraceType().printBacktrace(ex.getException(), runtime.getPosix().isatty(FileDescriptor.err));
  // rb_backtrace dumps to stderr directly.
  System.err.print(trace.replaceFirst("[^\n]*\n", ""));
}

代码示例来源:origin: org.jruby/jruby-complete

public void checkTTY() {
  if (fd.realFileno != -1 && runtime.getPosix().isatty(fd.realFileno) != 0
    || stdio_file != null) {
    boolean locked = lock();
    try {
      mode |= TTY | DUPLEX;
    } finally {
      if (locked) unlock();
    }
  }
  // Clear errno so ENOTTY does not get picked up elsewhere (jruby/jruby#4527
  runtime.getPosix().errno(0);
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"tty?", "isatty"})
public RubyBoolean tty_p(ThreadContext context) {
  try {
    return context.runtime.newBoolean(
        context.runtime.getPosix().isatty(
            getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()));
  } catch (BadDescriptorException e) {
    throw context.runtime.newErrnoEBADFError();
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = {"tty?", "isatty"})
public RubyBoolean tty_p(ThreadContext context) {
  try {
    return context.runtime.newBoolean(
        context.runtime.getPosix().isatty(
            getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()));
  } catch (BadDescriptorException e) {
    throw context.runtime.newErrnoEBADFError();
  }
}

相关文章

POSIX类方法