##// END OF EJS Templates
Add an option to disable stdin
Jessica B. Hamrick -
Show More
@@ -10,7 +10,7 b' try:'
10 except ImportError:
10 except ImportError:
11 from Queue import Empty # Py 2
11 from Queue import Empty # Py 2
12
12
13 from IPython.utils.traitlets import List, Unicode
13 from IPython.utils.traitlets import List, Unicode, Bool
14
14
15 from IPython.nbformat.v4 import output_from_msg
15 from IPython.nbformat.v4 import output_from_msg
16 from .base import Preprocessor
16 from .base import Preprocessor
@@ -25,6 +25,11 b' class ExecutePreprocessor(Preprocessor):'
25 timeout = Integer(30, config=True,
25 timeout = Integer(30, config=True,
26 help="The time to wait (in seconds) for output from executions."
26 help="The time to wait (in seconds) for output from executions."
27 )
27 )
28
29 allow_stdin = Bool(
30 False, config=True,
31 help="Whether stdin should be enabled when executing cells"
32 )
28
33
29 extra_arguments = List(Unicode)
34 extra_arguments = List(Unicode)
30
35
@@ -36,6 +41,7 b' class ExecutePreprocessor(Preprocessor):'
36 extra_arguments=self.extra_arguments,
41 extra_arguments=self.extra_arguments,
37 stderr=open(os.devnull, 'w')) as kc:
42 stderr=open(os.devnull, 'w')) as kc:
38 self.kc = kc
43 self.kc = kc
44 self.kc.allow_stdin = self.allow_stdin
39 nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
45 nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
40 return nb, resources
46 return nb, resources
41
47
General Comments 0
You need to be logged in to leave comments. Login now