Message12089
Here's an interesting way to find out whether stdin (and stdout) are interactive, that I hadn't noticed before:
PS jython-trunk> dist\bin\jython -c "from java.lang import System; print repr(System.console())"
java.io.Console@5a2fa51f
PS jython-trunk> echo hello | dist\bin\jython -c "from java.lang import System; print repr(System.console())"
None
PS jython-trunk> dist\bin\jython -c "from java.lang import System; print repr(System.console())" > x.tmp
PS jython-trunk> type x.tmp
None
Although it is a little difficult to follow internally, through SharedSecrets, it is clear that in the end Java calls an internal private istty() that determines whether the static console variable will be null or an instance of Console.class, so it is not simply a quirk of one platform or version. |
|
Date |
User |
Action |
Args |
2018-08-21 08:00:20 | jeff.allen | set | messageid: <1534838420.69.0.56676864532.issue2686@psf.upfronthosting.co.za> |
2018-08-21 08:00:20 | jeff.allen | set | recipients:
+ jeff.allen, zyasoft |
2018-08-21 08:00:20 | jeff.allen | link | issue2686 messages |
2018-08-21 08:00:19 | jeff.allen | create | |
|