PowerShell / PowerShell/PowerShellEditorServices

Close stray process when stdio pipe is closed or possibly when parent process is killed (daemon flag?)

オープン
#924 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Area-Tasks Issue-Bug
主要言語
C#
スター
767
フォーク
266
平均マージ
3日 16時間
マージ済み PR(30日)
1

説明

This is continuation of the effort from:

  1. Issue https://github.com/PowerShell/PowerShellEditorServices/issues/655 PSES needs to shutdown itself when it's supposed to
  2. PR https://github.com/PowerShell/PowerShellEditorServices/pull/663 Close stray processes on exit

#655 was closed by @TylerLeonhardt as it was satisfied by PR #663. However I still believe we can easily get into the situation when LSP text editor that launches PSES gets killed and orphans the PSES process, that keeps running without a purpose. Actually this is the case with Sublime Text and LSP plugin, where other language LSP providers shutdown themselves when the Sublime Text quits without a need to use exit or any other means.

Therefore I propose 2 options for consideration (alternatives):

  1. Introduce new -daemon flag, that unless specified, makes PSES to shutdown itself when the parent process disappears. This will make PSES behave like most of the command line tools, i.e. shutdown itself when the shell or launching process quits.

    The only purpose for PSES to run despite of parent process being alive or not is when it is it intended to be ran as a daemon, and I believe this intent should not be default (as it is now).

  2. Shutdown itself when running as -stdio and when pipe is closed, as I was commenting in other ticket, there is no point running when pipe is closes, because there is nobody that will be able to issue exit and any other command anyways.

Thank you in advance for considering my suggestion. If you prefer I can try to get this behavior adapter myself and send the PR, but you (maintainers) may come to more elegant solution much quicker than me, therefore I post this issue first.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず issue #655 と PR #663 を確認し、次に -stdio モードと提案されている -daemon フラグに対応する PSES のエントリーポイントを追跡します。親プロセスが消失した場合、または stdio パイプが閉じた場合に、どのシャットダウン動作が意図されているのかを判断してください。対象となるシナリオで残存する PSES プロセスがなくなり、daemon の使用を壊さなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp
領域
devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。