fix: swapped to just run the binary on the server

moved away from `sh -c`
This commit is contained in:
Andrew Rioux 2023-09-06 09:04:26 -04:00
parent 17e6056a03
commit 231108f2c3
Signed by: andrew.rioux
GPG Key ID: 9B8BAC47C17ABB94
3 changed files with 8 additions and 6 deletions

View File

@ -103,7 +103,6 @@ async fn run_command(
} }
Event::Remote(Response::CommandDone(cid, _)) if cid == id => break, Event::Remote(Response::CommandDone(cid, _)) if cid == id => break,
Event::Stdin(stdin) => { Event::Stdin(stdin) => {
println!("here");
let _ = connection let _ = connection
.send_command(Command::SendStdin(stdin, id)) .send_command(Command::SendStdin(stdin, id))
.await?; .await?;

View File

@ -10,6 +10,8 @@ use std::{
thread::{scope, Scope}, thread::{scope, Scope},
}; };
use anyhow::bail;
use sparse_05_common::messages::Response; use sparse_05_common::messages::Response;
use super::ConnectionInformation; use super::ConnectionInformation;
@ -31,7 +33,7 @@ pub(super) fn spawn_command<'a, 'b: 'a>(
let id = CURRENT_COMMAND_ID.fetch_add(1, Ordering::Relaxed); let id = CURRENT_COMMAND_ID.fetch_add(1, Ordering::Relaxed);
/*let mut command = command.split(" "); let mut command = command.trim().split(" ");
let bin_name = command.next(); let bin_name = command.next();
@ -45,13 +47,12 @@ pub(super) fn spawn_command<'a, 'b: 'a>(
bail!("could not get binary name from command"); bail!("could not get binary name from command");
}; };
let bin_name = bin_name.trim();
let mut command = Command::new(bin_name) let mut command = Command::new(bin_name)
.args(&command.collect::<Vec<_>>())*/ .args(&command.collect::<Vec<_>>())
let mut command = Command::new("sh") /*let mut command = Command::new("sh")
.arg("-c") .arg("-c")
.arg(&command) .arg(&command)*/
.env("TERM", "screen") .env("TERM", "screen")
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())

View File

@ -29,5 +29,7 @@ pub(super) fn start_file_upload<'a, 'b: 'a>(
let id = CURRENT_FILE_UPLOAD_ID.fetch_add(1, Ordering::Relaxed); let id = CURRENT_FILE_UPLOAD_ID.fetch_add(1, Ordering::Relaxed);
let buffer: Vec<Vec<u8>> = Vec::with_capacity(packet_count as usize);
Ok(UploadFileHandler { id, data_sender }) Ok(UploadFileHandler { id, data_sender })
} }