From 882ea431833a23f8e0f0636bb89641087c1724f4 Mon Sep 17 00:00:00 2001 From: Chaoqian Xu Date: Thu, 19 Dec 2024 10:38:19 +0800 Subject: [PATCH 1/5] refactor(shell): Use &self instead of self to allow kill to be called multiple times. --- plugins/shell/src/process/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index 44f037b015..ac801834a7 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -75,7 +75,7 @@ impl CommandChild { } /// Sends a kill signal to the child. - pub fn kill(self) -> crate::Result<()> { + pub fn kill(&self) -> crate::Result<()> { self.inner.kill()?; Ok(()) } From 126f5f4da74c476c9dfc59a4f45ded6c337cc635 Mon Sep 17 00:00:00 2001 From: Chaoqian Xu Date: Thu, 19 Dec 2024 14:27:31 +0800 Subject: [PATCH 2/5] feat(shell): add exit_status to get the child's exit status. --- plugins/shell/src/process/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index ac801834a7..0cca55c061 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -80,6 +80,13 @@ impl CommandChild { Ok(()) } + /// Return the child's exit status if it has already exited. If the child is + /// still running, return `Ok(None)`. + pub fn exit_status(&self) -> crate::Result> { + let status = self.inner.try_wait()?; + Ok(status.map(|s| ExitStatus { code: s.code() })) + } + /// Returns the process pid. pub fn pid(&self) -> u32 { self.inner.id() From bb8609f87cc6d35be03d23d23a1c400a0ca2794e Mon Sep 17 00:00:00 2001 From: Chaoqian Xu Date: Thu, 19 Dec 2024 14:41:02 +0800 Subject: [PATCH 3/5] Revert "feat(shell): add exit_status to get the child's exit status." This reverts commit 126f5f4da74c476c9dfc59a4f45ded6c337cc635. --- plugins/shell/src/process/mod.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/plugins/shell/src/process/mod.rs b/plugins/shell/src/process/mod.rs index 0cca55c061..ac801834a7 100644 --- a/plugins/shell/src/process/mod.rs +++ b/plugins/shell/src/process/mod.rs @@ -80,13 +80,6 @@ impl CommandChild { Ok(()) } - /// Return the child's exit status if it has already exited. If the child is - /// still running, return `Ok(None)`. - pub fn exit_status(&self) -> crate::Result> { - let status = self.inner.try_wait()?; - Ok(status.map(|s| ExitStatus { code: s.code() })) - } - /// Returns the process pid. pub fn pid(&self) -> u32 { self.inner.id() From dd59321faf16478cda8a4f5878575f1d41249158 Mon Sep 17 00:00:00 2001 From: Chaoqian Xu Date: Thu, 19 Dec 2024 19:45:26 +0800 Subject: [PATCH 4/5] Create change-pr-2224.md --- .changes/change-pr-2224.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changes/change-pr-2224.md diff --git a/.changes/change-pr-2224.md b/.changes/change-pr-2224.md new file mode 100644 index 0000000000..616344f936 --- /dev/null +++ b/.changes/change-pr-2224.md @@ -0,0 +1,5 @@ +--- +"shell": patch +--- + +Use &self instead of self to allow kill to be called multiple times. From c5205e1ed8f440e677625c2558415ebe16ce7fcf Mon Sep 17 00:00:00 2001 From: Chaoqian Xu Date: Fri, 20 Dec 2024 08:01:02 +0800 Subject: [PATCH 5/5] chore(shell): add patch bump for JS package shell-js --- .changes/change-pr-2224.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.changes/change-pr-2224.md b/.changes/change-pr-2224.md index 616344f936..b1a0f00b9c 100644 --- a/.changes/change-pr-2224.md +++ b/.changes/change-pr-2224.md @@ -1,5 +1,6 @@ --- "shell": patch +"shell-js": patch --- -Use &self instead of self to allow kill to be called multiple times. +Use &self instead of self to allow kill to be called multiple times.