File tree Expand file tree Collapse file tree 1 file changed +34
-1
lines changed
Expand file tree Collapse file tree 1 file changed +34
-1
lines changed Original file line number Diff line number Diff line change 44#
55
66import ntpath
7- from typing import Callable
7+ from typing import Callable , TextIO
88
99from unicorn import UcError
1010
@@ -93,6 +93,39 @@ def __make_fcall_selector(atype: QL_ARCH) -> Callable[[int], QlFunctionCall]:
9393 self .services = {}
9494 self .load ()
9595
96+ # only after handle manager has been set up we can assign the standard streams
97+ self .stdin = self ._stdin
98+ self .stdout = self ._stdout
99+ self .stderr = self ._stderr
100+
101+
102+ @QlOs .stdin .setter
103+ def stdin (self , stream : TextIO ) -> None :
104+ self ._stdin = stream
105+
106+ handle = self .handle_manager .get (const .STD_INPUT_HANDLE )
107+ assert handle is not None
108+
109+ handle .obj = stream
110+
111+ @QlOs .stdout .setter
112+ def stdout (self , stream : TextIO ) -> None :
113+ self ._stdout = stream
114+
115+ handle = self .handle_manager .get (const .STD_OUTPUT_HANDLE )
116+ assert handle is not None
117+
118+ handle .obj = stream
119+
120+ @QlOs .stderr .setter
121+ def stderr (self , stream : TextIO ) -> None :
122+ self ._stderr = stream
123+
124+ handle = self .handle_manager .get (const .STD_ERROR_HANDLE )
125+ assert handle is not None
126+
127+ handle .obj = stream
128+
96129
97130 def load (self ):
98131 self .setupGDT ()
You can’t perform that action at this time.
0 commit comments