We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
wait
hooks.editor
1 parent 64a5061 commit ceaa52cCopy full SHA for ceaa52c
1 file changed
IPython/core/hooks.py
@@ -42,6 +42,7 @@ def calljed(self,filename, linenum):
42
#*****************************************************************************
43
44
import os, bisect
45
+import subprocess
46
import sys
47
48
from IPython.core.error import TryNext
@@ -54,7 +55,7 @@ def calljed(self,filename, linenum):
54
55
'show_in_pager','pre_prompt_hook',
56
'pre_run_code_hook', 'clipboard_get']
57
-def editor(self,filename, linenum=None):
58
+def editor(self, filename, linenum=None, wait=True):
59
"""Open the default editor at the given filename and linenumber.
60
61
This is IPython's default editor hook, you can use it as an example to
@@ -76,7 +77,9 @@ def editor(self,filename, linenum=None):
76
77
editor = '"%s"' % editor
78
79
# Call the actual editor
- if os.system('%s %s %s' % (editor,linemark,filename)) != 0:
80
+ proc = subprocess.Popen('%s %s %s' % (editor, linemark, filename),
81
+ shell=True)
82
+ if wait and proc.wait() != 0:
83
raise TryNext()
84
85
import tempfile
0 commit comments