File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -104,14 +104,21 @@ def init_kernel_info(self):
104
104
def start (self ):
105
105
self .log .debug ("jupyter run: starting..." )
106
106
super (RunApp , self ).start ()
107
- for filename in self .filenames_to_run :
108
- self .log .debug ("jupyter run: executing `%s`" % filename )
109
- with open (filename ) as fp :
110
- code = fp .read ()
111
- reply = self .kernel_client .execute (code , reply = True )
112
- return_code = 0 if reply ['content' ]['status' ] == 'ok' else 1
113
- if return_code :
114
- raise Exception ("jupyter-run error running '%s'" % filename )
107
+ if self .filenames_to_run :
108
+ for filename in self .filenames_to_run :
109
+ self .log .debug ("jupyter run: executing `%s`" % filename )
110
+ with open (filename ) as fp :
111
+ code = fp .read ()
112
+ reply = self .kernel_client .execute (code , reply = True )
113
+ return_code = 0 if reply ['content' ]['status' ] == 'ok' else 1
114
+ if return_code :
115
+ raise Exception ("jupyter-run error running '%s'" % filename )
116
+ else :
117
+ code = sys .stdin .read ()
118
+ reply = self .kernel_client .execute (code , reply = True )
119
+ return_code = 0 if reply ['content' ]['status' ] == 'ok' else 1
120
+ if return_code :
121
+ raise Exception ("jupyter-run error running 'stdin'" )
115
122
116
123
main = launch_new_instance = RunApp .launch_instance
117
124
You can’t perform that action at this time.
0 commit comments