未验证 提交 4996edbc 编写于 作者: S SunGaofeng 提交者: GitHub

fix subprocess not stopping bug when main process was killed (#2230)

* fix subprocess not stopping bug

* term -> _term
上级 99f5b2d6
......@@ -12,9 +12,20 @@
#See the License for the specific language governing permissions and
#limitations under the License.
import os
import signal
__all__ = ['AttrDict']
def _term(sig_num, addition):
print('current pid is %s, group id is %s' % (os.getpid(), os.getpgrp()))
os.killpg(os.getpgid(os.getpid()), signal.SIGKILL)
signal.signal(signal.SIGTERM, _term)
class AttrDict(dict):
def __getattr__(self, key):
return self[key]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册