Message12089

Author jeff.allen
Recipients jeff.allen, zyasoft
Date 2018-08-21.08:00:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1534838420.69.0.56676864532.issue2686@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-08-21 08:00:20jeff.allensetmessageid: <1534838420.69.0.56676864532.issue2686@psf.upfronthosting.co.za>
2018-08-21 08:00:20jeff.allensetrecipients: + jeff.allen, zyasoft
2018-08-21 08:00:20jeff.allenlinkissue2686 messages
2018-08-21 08:00:19jeff.allencreate