$EDITOR
定義済みまたはを呼び出す必要があるPythonスクリプトがあります$VISUAL
。Pythonスクリプトを単独で呼び出すと、$EDITOR
問題なく起動できますが、Pythonスクリプトに何かをパイプした瞬間、$EDITOR
は起動できません。今、私はナノを使用しています。
SIGHUPまたはSIGTERMを受信しました
毎回。ここで説明したのと同じ問題のようです。
sinister:Programming [1313]$ echo "import os;os.system('nano')" > "sample.py"
sinister:Programming [1314]$ python sample.py
# nano is successfully launched here.
sinister:Programming [1315]$ echo "It dies here." | python sample.py
Received SIGHUP or SIGTERM
Buffer written to nano.save.1
編集:明確化; プログラム内では、私はエディターに接続していません。コードは次のとおりです。
editorprocess = subprocess.Popen([editor or "vi", temppath])
editorreturncode = os.waitpid(editorprocess.pid, 0)[1]