##// END OF EJS Templates
fix kernel_argv scrubbing to cover args passed with space...
MinRK -
Show More
@@ -212,11 +212,20 b' class IPythonNotebookApp(BaseIPythonApplication):'
212 for a in argv:
212 for a in argv:
213 if a.startswith('-') and a.lstrip('-') in notebook_flags:
213 if a.startswith('-') and a.lstrip('-') in notebook_flags:
214 self.kernel_argv.remove(a)
214 self.kernel_argv.remove(a)
215 swallow_next = False
215 for a in argv:
216 for a in argv:
217 if swallow_next:
218 self.kernel_argv.remove(a)
219 swallow_next = False
220 continue
216 if a.startswith('-'):
221 if a.startswith('-'):
217 alias = a.lstrip('-').split('=')[0]
222 split = a.lstrip('-').split('=')[0]
223 alias = split[0]
218 if alias in notebook_aliases:
224 if alias in notebook_aliases:
219 self.kernel_argv.remove(a)
225 self.kernel_argv.remove(a)
226 if len(split) == 1:
227 # alias passed with arg via space
228 swallow_next = True
220
229
221 def init_configurables(self):
230 def init_configurables(self):
222 # Don't let Qt or ZMQ swallow KeyboardInterupts.
231 # Don't let Qt or ZMQ swallow KeyboardInterupts.
@@ -204,10 +204,6 b' qt_flags.update(boolean_flag('
204 """
204 """
205 ))
205 ))
206 flags.update(qt_flags)
206 flags.update(qt_flags)
207 # the flags that are specific to the frontend
208 # these must be scrubbed before being passed to the kernel,
209 # or it will raise an error on unrecognized flags
210 qt_flags = qt_flags.keys()
211
207
212 aliases = dict(ipkernel_aliases)
208 aliases = dict(ipkernel_aliases)
213
209
@@ -227,8 +223,6 b' qt_aliases = dict('
227 ssh = 'IPythonQtConsoleApp.sshserver',
223 ssh = 'IPythonQtConsoleApp.sshserver',
228 )
224 )
229 aliases.update(qt_aliases)
225 aliases.update(qt_aliases)
230 # also scrub aliases from the frontend
231 qt_flags.extend(qt_aliases.keys())
232
226
233
227
234 #-----------------------------------------------------------------------------
228 #-----------------------------------------------------------------------------
@@ -327,13 +321,24 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
327 self.kernel_argv = list(argv) # copy
321 self.kernel_argv = list(argv) # copy
328 # kernel should inherit default config file from frontend
322 # kernel should inherit default config file from frontend
329 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
323 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
330 # scrub frontend-specific flags
324 # Scrub frontend-specific flags
331 for a in argv:
325 for a in argv:
332
326 if a.startswith('-') and a.lstrip('-') in qt_flags:
327 self.kernel_argv.remove(a)
328 swallow_next = False
329 for a in argv:
330 if swallow_next:
331 self.kernel_argv.remove(a)
332 swallow_next = False
333 continue
333 if a.startswith('-'):
334 if a.startswith('-'):
334 key = a.lstrip('-').split('=')[0]
335 split = a.lstrip('-').split('=')[0]
335 if key in qt_flags:
336 alias = split[0]
337 if alias in qt_aliases:
336 self.kernel_argv.remove(a)
338 self.kernel_argv.remove(a)
339 if len(split) == 1:
340 # alias passed with arg via space
341 swallow_next = True
337
342
338 def init_ssh(self):
343 def init_ssh(self):
339 """set up ssh tunnels, if needed."""
344 """set up ssh tunnels, if needed."""
General Comments 0
You need to be logged in to leave comments. Login now