Skip to content

Commit cced088

Browse files
committed
for now, report that we have a tty if System.console is available
1 parent 39c0ba2 commit cced088

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import static com.oracle.graal.python.runtime.exception.PythonErrorType.ValueError;
3434

3535
import java.io.BufferedReader;
36+
import java.io.Console;
3637
import java.io.IOException;
3738
import java.io.InputStream;
3839
import java.io.InputStreamReader;
@@ -854,15 +855,15 @@ protected boolean readOpaque(VirtualFrame frame) {
854855
@TypeSystemReference(PythonArithmeticTypes.class)
855856
public abstract static class IsATTYNode extends PythonBuiltinNode {
856857
@Specialization
858+
@TruffleBoundary
857859
boolean isATTY(int fd) {
858860
// TODO: XXX: actually check
861+
Console console = System.console();
859862
switch (fd) {
860863
case 0:
861-
return getContext().getStandardIn() == System.in;
862864
case 1:
863-
return getContext().getStandardOut() == System.out;
864865
case 2:
865-
return getContext().getStandardErr() == System.err;
866+
return console != null;
866867
default:
867868
return false;
868869
}

0 commit comments

Comments
 (0)