<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>arterminal</author_name>
  <author_url>https://blog.hatena.ne.jp/arterminal/</author_url>
  <blog_title>arterminalのブログ</blog_title>
  <blog_url>https://arterminal.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>課題 解決策 対策概要 発生状況 対策詳細 所感 注意 参考 課題 subprocessモジュールを利用して外部のシェルスクリプトを起動することがある。そのシェルスクリプトにおいて子プロセス（バックグラウンドプロセスなど）が動作している最中に、subprocessで設定したtimeoutが発生した。このとき、直接起動したシェルスクリプトのプロセスはkillされるが、その子プロセスは残存しているようだ。timeoutが発生した際には子プロセスも含めてkillしたいがどうすればよいか。 解決策 対策概要 起動するプロセスを別のセッションとして管理し、python の timeout 例外 catc…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Farterminal.hatenablog.com%2Fentry%2F2024%2F11%2F09%2F152446&quot; title=&quot;subprocess で timeout が発生した際に子プロセスをまとめてkillする（Python） - arterminalのブログ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-11-09 15:24:46</published>
  <title>subprocess で timeout が発生した際に子プロセスをまとめてkillする（Python）</title>
  <type>rich</type>
  <url>https://arterminal.hatenablog.com/entry/2024/11/09/152446</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
