Skip to content

Commit

Permalink
Fixed Using conditional compilation to fix running on both Windows an…
Browse files Browse the repository at this point in the history
…d Linux
  • Loading branch information
simonhyll committed Dec 2, 2022
1 parent fe03580 commit 00eef86
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ license-file = "LICENSE.txt"
name = "cargo-commander"
readme = "README.md"
repository = "https://github.com/simonhyll/cargo-commander"
version = "2.0.14"
version = "2.0.15"
default-run = "cargo-cmd"

[[bin]]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cargo install cargo-commander
cargo cmd COMMAND

# Output of 'cargo cmd --help'
cargo-commander 2.0.14
cargo-commander 2.0.15
A powerful tool for managing project commands

USAGE:
Expand Down
11 changes: 7 additions & 4 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ impl Command {

let spawned_child;

if cfg!(windows) {
#[cfg(target_os = "windows")]
{
use std::os::windows::process::CommandExt;
spawned_child = std::process::Command::new("cmd")
.arg("/C")
Expand All @@ -136,11 +137,13 @@ impl Command {
.current_dir(&working_dir)
.spawn()
.expect("failed to spawn");
} else {
}
#[cfg(not(target_os = "windows"))]
{
spawned_child = std::process::Command::new("sh")
.arg("-c")
.args(cmd)
.args(&args)
.arg(cmd.join(" "))
.arg(args.join(" "))
.envs(&self.env)
.current_dir(&working_dir)
.spawn()
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn main() -> Result<(), std::io::Error> {
commander_args.insert("parallel".to_string(), args.remove(0));
} else if args[0] == "-h" || args[0] == "--help" {
println!(
r"cargo-commander 2.0.14
r"cargo-commander 2.0.15
A powerful tool for managing project commands
USAGE:
Expand Down
2 changes: 1 addition & 1 deletion tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "Cargo Commander",
"version": "2.0.14"
"version": "2.0.15"
},
"tauri": {
"allowlist": {
Expand Down

0 comments on commit 00eef86

Please sign in to comment.