Repository: aome510/spotify-player (language: rust)

Issue:
Copying links leaves zombie processes
**Describe the bug**
Using the copy link command leaves a zombie ``wl-copy`` process.

**To Reproduce**
1. Set the copy command to just ``wl-copy``.
2. Copy a track/album link.
3. Observe a zombie ``wl-copy`` process:

**Expected behavior**
Not have a zombie process.

**Log and backtrace**
Log: https://gist.github.com/Fuyukai/9d60b4fc539999e98743c3977e53656e

**Screenshots**
![image](https://github.com/aome510/spotify-player/assets/8783751/aaf648c7-f3ad-48ed-9f5f-78d19192f621)

**Environment**

- OS: Linux 6.6
- Application version: v0.16.3
- Application features: ``image``, ``notify``, ``lyric-finder``

**Additional context**
n/a



Discussion / hints:

Fix patch:
diff --git a/spotify_player/src/event/popup.rs b/spotify_player/src/event/popup.rs
index a1caf0b2..bb1f17db 100644
--- a/spotify_player/src/event/popup.rs
+++ b/spotify_player/src/event/popup.rs
@@ -466,14 +466,16 @@ fn execute_copy_command(cmd: &config::Command, text: String) -> Result<()> {
         .stdout(std::process::Stdio::piped())
         .spawn()?;
 
-    let mut stdin = match child.stdin.take() {
-        Some(stdin) => stdin,
-        None => anyhow::bail!("no stdin found in the child command"),
+    let result = match child.stdin.take() {
+        Some(mut stdin) => stdin
+            .write_all(text.as_bytes())
+            .map_err(anyhow::Error::from),
+        None => Err(anyhow::anyhow!("no stdin found in the child command")),
     };
 
-    stdin.write_all(text.as_bytes())?;
+    child.wait()?;
 
-    Ok(())
+    result
 }
 
 /// handles a key sequence for an action list popup


Test patch: