mirror of
https://github.com/casey/just.git
synced 2024-11-23 11:04:09 +03:00
Omit shebang lines on Windows (#1417)
This commit is contained in:
parent
56feaeedc3
commit
e27e12ab1a
@ -47,7 +47,7 @@ impl<'line> Shebang<'line> {
|
||||
}
|
||||
|
||||
pub(crate) fn include_shebang_line(&self) -> bool {
|
||||
!matches!(self.interpreter_filename(), "cmd" | "cmd.exe")
|
||||
!cfg!(windows) && !matches!(self.interpreter_filename(), "cmd" | "cmd.exe")
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,7 +201,14 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn include_shebang_line_other() {
|
||||
#[cfg(not(windows))]
|
||||
fn include_shebang_line_other_not_windows() {
|
||||
assert!(Shebang::new("#!foo -c").unwrap().include_shebang_line());
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn include_shebang_line_other_windows() {
|
||||
assert!(!Shebang::new("#!foo -c").unwrap().include_shebang_line());
|
||||
}
|
||||
}
|
||||
|
@ -1081,6 +1081,7 @@ test! {
|
||||
stderr: "#!/bin/sh\necho hello\n",
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
test! {
|
||||
name: shebang_line_numbers,
|
||||
justfile: r#"
|
||||
@ -1100,6 +1101,36 @@ test! {
|
||||
#!/usr/bin/env cat
|
||||
|
||||
|
||||
a
|
||||
|
||||
b
|
||||
|
||||
|
||||
c
|
||||
",
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
test! {
|
||||
name: shebang_line_numbers,
|
||||
justfile: r#"
|
||||
quiet:
|
||||
#!/usr/bin/env cat
|
||||
|
||||
a
|
||||
|
||||
b
|
||||
|
||||
|
||||
c
|
||||
|
||||
|
||||
"#,
|
||||
stdout: "
|
||||
|
||||
|
||||
|
||||
|
||||
a
|
||||
|
||||
b
|
||||
|
@ -24,13 +24,21 @@ fn test_tempdir_is_set() {
|
||||
}
|
||||
})
|
||||
.current_dir("foo")
|
||||
.stdout(
|
||||
.stdout(if cfg!(windows) {
|
||||
"
|
||||
|
||||
|
||||
|
||||
|
||||
cat just*/foo
|
||||
"
|
||||
} else {
|
||||
"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
cat just*/foo
|
||||
",
|
||||
)
|
||||
"
|
||||
})
|
||||
.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user