Skip to content

Commit

Permalink
#37: Quote the path to Shawl itself
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Sep 30, 2023
1 parent e70280f commit 277aa1d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Fixed: The path to the Shawl executable was not quoted when it contained spaces.

## v1.2.1 (2023-08-10)

* Fixed: Possible case in which old log files would not be deleted.
Expand Down
8 changes: 6 additions & 2 deletions src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ use log::error;
use std::io::Write;

pub fn add_service(name: String, cwd: Option<String>, opts: CommonOpts) -> Result<(), ()> {
let shawl_path = std::env::current_exe().expect("Unable to determine Shawl location");
let shawl_path = quote(
&std::env::current_exe()
.expect("Unable to determine Shawl location")
.to_string_lossy(),
);
let shawl_args = construct_shawl_run_args(&name, &cwd, &opts);
let prepared_command = prepare_command(&opts.command);

Expand All @@ -13,7 +17,7 @@ pub fn add_service(name: String, cwd: Option<String>, opts: CommonOpts) -> Resul
.arg("binPath=")
.arg(format!(
"{} {} -- {}",
shawl_path.display(),
shawl_path,
shawl_args.join(" "),
prepared_command.join(" ")
))
Expand Down

0 comments on commit 277aa1d

Please sign in to comment.