Show More
@@ -19,7 +19,7 b' def init_ipython(ipy):' | |||||
19 | """ |
|
19 | """ | |
20 | global ip |
|
20 | global ip | |
21 | ip = ipy |
|
21 | ip = ipy | |
22 | ip.set_hook('complete_command', mb_completer, str_key = 'mb') |
|
22 | ip.set_hook('complete_command', mb_completer, str_key = '%mb') | |
23 | ip.expose_magic('mb',mb_f) |
|
23 | ip.expose_magic('mb',mb_f) | |
24 | ip.expose_magic('lee',lee_f) |
|
24 | ip.expose_magic('lee',lee_f) | |
25 | ip.expose_magic('leoref',leoref_f) |
|
25 | ip.expose_magic('leoref',leoref_f) |
@@ -133,20 +133,33 b' else:' | |||||
133 |
|
133 | |||
134 | def jobctrl_shellcmd(ip,cmd): |
|
134 | def jobctrl_shellcmd(ip,cmd): | |
135 | """ os.system replacement that stores process info to db['tasks/t1234'] """ |
|
135 | """ os.system replacement that stores process info to db['tasks/t1234'] """ | |
|
136 | cmd = cmd.strip() | |||
136 | cmdname = cmd.split(None,1)[0] |
|
137 | cmdname = cmd.split(None,1)[0] | |
137 | if cmdname in shell_internal_commands: |
|
138 | if cmdname in shell_internal_commands: | |
138 | use_shell = True |
|
139 | use_shell = True | |
139 | else: |
|
140 | else: | |
140 | use_shell = False |
|
141 | use_shell = False | |
141 |
|
142 | |||
142 | p = Popen(cmd,shell = use_shell) |
|
143 | jobentry = None | |
143 | jobentry = 'tasks/t' + str(p.pid) |
|
|||
144 |
|
||||
145 | try: |
|
144 | try: | |
|
145 | try: | |||
|
146 | p = Popen(cmd,shell = use_shell) | |||
|
147 | except WindowsError: | |||
|
148 | if use_shell: | |||
|
149 | # try with os.system | |||
|
150 | os.system(cmd) | |||
|
151 | return | |||
|
152 | else: | |||
|
153 | # have to go via shell, sucks | |||
|
154 | p = Popen(cmd,shell = True) | |||
|
155 | ||||
|
156 | jobentry = 'tasks/t' + str(p.pid) | |||
146 | ip.db[jobentry] = (p.pid,cmd,os.getcwd(),time.time()) |
|
157 | ip.db[jobentry] = (p.pid,cmd,os.getcwd(),time.time()) | |
147 | p.communicate() |
|
158 | p.communicate() | |
|
159 | ||||
148 | finally: |
|
160 | finally: | |
149 |
|
|
161 | if jobentry: | |
|
162 | del ip.db[jobentry] | |||
150 |
|
163 | |||
151 |
|
164 | |||
152 | def install(): |
|
165 | def install(): |
General Comments 0
You need to be logged in to leave comments.
Login now