diff --git a/Cargo.lock b/Cargo.lock
index a3a801b..3e52081 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2238,6 +2238,7 @@ dependencies = [
  "serde",
  "serde_json",
  "static_vcruntime",
+ "strip-ansi-escapes",
  "strsim",
  "sudo",
  "sysinfo",
@@ -4640,6 +4641,15 @@ version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
 
+[[package]]
+name = "strip-ansi-escapes"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55ff8ef943b384c414f54aefa961dd2bd853add74ec75e7ac74cf91dba62bcfa"
+dependencies = [
+ "vte",
+]
+
 [[package]]
 name = "strsim"
 version = "0.10.0"
@@ -5839,6 +5849,12 @@ dependencies = [
  "log",
 ]
 
+[[package]]
+name = "utf8parse"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
+
 [[package]]
 name = "vcpkg"
 version = "0.2.15"
@@ -5869,6 +5885,26 @@ version = "1.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
 
+[[package]]
+name = "vte"
+version = "0.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f5022b5fbf9407086c180e9557be968742d839e68346af7792b8592489732197"
+dependencies = [
+ "utf8parse",
+ "vte_generate_state_changes",
+]
+
+[[package]]
+name = "vte_generate_state_changes"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
+dependencies = [
+ "proc-macro2",
+ "quote",
+]
+
 [[package]]
 name = "waker-fn"
 version = "1.1.0"
diff --git a/Cargo.toml b/Cargo.toml
index 83bcb7b..ef603aa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -72,6 +72,7 @@ tor-rtcompat = "0.9.0"
 walkdir = "2.3.3"
 zeroize = "1.6.0"
 strsim = "0.10.0"
+strip-ansi-escapes = "0.2.0"
 
 # Unix dependencies
 [target.'cfg(unix)'.dependencies]
diff --git a/src/helper.rs b/src/helper.rs
index 2666307..4a6b6bc 100644
--- a/src/helper.rs
+++ b/src/helper.rs
@@ -273,15 +273,18 @@ impl Helper {
 		let mut stdout = std::io::BufReader::new(reader).lines();
 
 		// Run a ANSI escape sequence filter for the first few lines.
-		for (i, line) in stdout.next().enumerate() {
-			let Some(Ok(line)) = line else { continue; }
+		let mut i = 0;
+		while let Some(Ok(line)) = stdout.next() {
 			let line = strip_ansi_escapes::strip_str(line);
 			if let Err(e) = writeln!(lock!(output_parse), "{}", line) { error!("XMRig PTY Parse | Output error: {}", e); }
 			if let Err(e) = writeln!(lock!(output_pub), "{}", line) { error!("XMRig PTY Pub | Output error: {}", e); }
 			if i > 20 {
 				break;
+			} else {
+				i += 1;
 			}
 		}
+		drop(i);
 
 		while let Some(Ok(line)) = stdout.next() {
 //			println!("{}", line); // For debugging.
@@ -295,15 +298,18 @@ impl Helper {
 		let mut stdout = std::io::BufReader::new(reader).lines();
 
 		// Run a ANSI escape sequence filter for the first few lines.
-		for (i, line) in stdout.next().enumerate() {
-			let Some(Ok(line)) = line else { continue; }
+		let mut i = 0;
+		while let Some(Ok(line)) = stdout.next() {
 			let line = strip_ansi_escapes::strip_str(line);
 			if let Err(e) = writeln!(lock!(output_parse), "{}", line) { error!("P2Pool PTY Parse | Output error: {}", e); }
 			if let Err(e) = writeln!(lock!(output_pub), "{}", line) { error!("P2Pool PTY Pub | Output error: {}", e); }
 			if i > 20 {
 				break;
+			} else {
+				i += 1;
 			}
 		}
+		drop(i);
 
 		while let Some(Ok(line)) = stdout.next() {
 //			println!("{}", line); // For debugging.