diff --git a/IPython/core/magics/script.py b/IPython/core/magics/script.py index 8631c30..31191c0 100644 --- a/IPython/core/magics/script.py +++ b/IPython/core/magics/script.py @@ -205,7 +205,7 @@ class ScriptMagics(Magics, Configurable): self.shell.user_ns[args.out] = p.stdout if args.err: self.shell.user_ns[args.err] = p.stderr - self.job_manager.new(self._run_script, p, cell) + self.job_manager.new(self._run_script, p, cell, daemon=True) if args.proc: self.shell.user_ns[args.proc] = p return diff --git a/IPython/lib/backgroundjobs.py b/IPython/lib/backgroundjobs.py index 395edd3..8b57bea 100644 --- a/IPython/lib/backgroundjobs.py +++ b/IPython/lib/backgroundjobs.py @@ -140,6 +140,8 @@ class BackgroundJobManager(object): In both cases, the result is stored in the job.result field of the background job object. + You can set `daemon` attribute of the thread by giving the keyword + argument `daemon`. Notes and caveats: @@ -181,7 +183,9 @@ class BackgroundJobManager(object): job = BackgroundJobExpr(func_or_exp, glob, loc) else: raise TypeError('invalid args for new job') - + + if kwargs.get('daemon', False): + job.daemon = True job.num = len(self.all)+1 if self.all else 0 self.running.append(job) self.all[job.num] = job