##// END OF EJS Templates
Start threads for %%script as daemon thread
Takafumi Arakaki -
Show More
@@ -205,7 +205,7 b' class ScriptMagics(Magics, Configurable):'
205 205 self.shell.user_ns[args.out] = p.stdout
206 206 if args.err:
207 207 self.shell.user_ns[args.err] = p.stderr
208 self.job_manager.new(self._run_script, p, cell)
208 self.job_manager.new(self._run_script, p, cell, daemon=True)
209 209 if args.proc:
210 210 self.shell.user_ns[args.proc] = p
211 211 return
@@ -140,6 +140,8 b' class BackgroundJobManager(object):'
140 140 In both cases, the result is stored in the job.result field of the
141 141 background job object.
142 142
143 You can set `daemon` attribute of the thread by giving the keyword
144 argument `daemon`.
143 145
144 146 Notes and caveats:
145 147
@@ -181,7 +183,9 b' class BackgroundJobManager(object):'
181 183 job = BackgroundJobExpr(func_or_exp, glob, loc)
182 184 else:
183 185 raise TypeError('invalid args for new job')
184
186
187 if kwargs.get('daemon', False):
188 job.daemon = True
185 189 job.num = len(self.all)+1 if self.all else 0
186 190 self.running.append(job)
187 191 self.all[job.num] = job
General Comments 0
You need to be logged in to leave comments. Login now