Use OsStr for systemd unit exec value
This commit is contained in:
parent
36b85ff350
commit
d363254f6e
3 changed files with 10 additions and 8 deletions
|
|
@ -1,8 +1,9 @@
|
|||
use std::path::Path;
|
||||
use std::ffi::OsStr;
|
||||
|
||||
pub fn socket_service(
|
||||
socket_path: impl AsRef<Path>,
|
||||
exec: &str,
|
||||
exec: &OsStr,
|
||||
dir: impl AsRef<Path>,
|
||||
additional: &str,
|
||||
) -> String {
|
||||
|
|
@ -18,7 +19,7 @@ Restart=always
|
|||
WantedBy=default.target
|
||||
",
|
||||
socket_path.as_ref().to_str().unwrap(),
|
||||
exec,
|
||||
exec.display(),
|
||||
dir.as_ref().to_str().unwrap(),
|
||||
additional
|
||||
)
|
||||
|
|
@ -31,7 +32,7 @@ pub fn nodejs_service<N: AsRef<Path>, S: AsRef<Path>>(
|
|||
) -> String {
|
||||
socket_service(
|
||||
&socket_path,
|
||||
&format!("/usr/bin/nodejs {}", nodejs_path.as_ref().to_str().unwrap()),
|
||||
format!("/usr/bin/nodejs {}", nodejs_path.as_ref().to_str().unwrap()).as_ref(),
|
||||
dir,
|
||||
&format!(
|
||||
"Environment=NODE_ENV=production
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue