Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Teoh Han Hui <[email protected]>
  • Loading branch information
slp and teohhanhui authored Jun 5, 2024
1 parent f3ea74f commit 64894ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/krun-server/src/bin/krun-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ fn main() -> Result<()> {

let server_thread = start_server(listener);

let err = Command::new(&options.command)
let status = Command::new(&options.command)
.args(options.command_args)
.status();
if let Err(err) = err {
if let Err(err) = status {
println!("Error executing command {}: {}", options.command, err);
}

Expand Down
6 changes: 4 additions & 2 deletions crates/krun-server/src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ pub struct Options {

pub fn options() -> OptionParser<Options> {
let server_port = env("KRUN_SERVER_PORT")
.short('p')
.help("TCP port to listen for command launch requests")
.argument::<u32>("KRUN_SERVER_PORT")
.fallback(3333);
.argument("SERVER_PORT")
.fallback(3333)
.display_fallback();
let command = positional("COMMAND");
let command_args = any::<String, _, _>("COMMAND_ARGS", |arg| {
(!["--help", "-h"].contains(&&*arg)).then_some(arg)
Expand Down
2 changes: 1 addition & 1 deletion crates/utils/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashMap;

use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize)]
pub struct Launch {
pub command: String,
pub args: Vec<String>,
Expand Down

0 comments on commit 64894ad

Please sign in to comment.