@@ -320,7 +320,7 @@ def _watch_pipe_fd(self):
320320 self ._exc = sys .exc_info ()
321321
322322 def __init__ (
323- self , session , pub_thread , name , pipe = None , echo = None , * , watchfd = True
323+ self , session , pub_thread , name , pipe = None , echo = None , * , watchfd = True , isatty = False ,
324324 ):
325325 """
326326 Parameters
@@ -333,6 +333,8 @@ def __init__(
333333 the file descriptor by its number. It will spawn a watching thread,
334334 that will swap the give file descriptor for a pipe, read from the
335335 pipe, and insert this into the current Stream.
336+ isatty : bool (default, False)
337+ Indication of whether this stream has termimal capabilities (e.g. can handle colors)
336338
337339 """
338340 if pipe is not None :
@@ -364,6 +366,7 @@ def __init__(
364366 self ._io_loop = pub_thread .io_loop
365367 self ._new_buffer ()
366368 self .echo = None
369+ self ._isatty = bool (isatty )
367370
368371 if (
369372 watchfd
@@ -381,6 +384,14 @@ def __init__(
381384 else :
382385 raise ValueError ("echo argument must be a file like object" )
383386
387+ def isatty (self ):
388+ """Return a bool indicating whether this is an 'interactive' stream.
389+
390+ Returns:
391+ Boolean
392+ """
393+ return self ._isatty
394+
384395 def _setup_stream_redirects (self , name ):
385396 pr , pw = os .pipe ()
386397 fno = getattr (sys , name ).fileno ()
0 commit comments