2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2019-07-13 01:55:06 -07:00
|
|
|
|
2019-09-21 15:35:03 -07:00
|
|
|
pub(crate) trait PlatformInterface {
|
2020-02-14 04:49:25 -08:00
|
|
|
/// Construct a command equivalent to running the script at `path` with the
|
|
|
|
/// shebang line `shebang`
|
2019-07-13 01:55:06 -07:00
|
|
|
fn make_shebang_command(
|
|
|
|
path: &Path,
|
Gargantuan refactor (#522)
- Instead of changing the current directory with `env::set_current_dir`
to be implicitly inherited by subprocesses, we now use
`Command::current_dir` to set it explicitly. This feels much better,
since we aren't dependent on the implicit state of the process's
current directory.
- Subcommand execution is much improved.
- Added a ton of tests for config parsing, config execution, working
dir, and search dir.
- Error messages are improved. Many more will be colored.
- The Config is now onwed, instead of borrowing from the arguments and
the `clap::ArgMatches` object. This is a huge ergonomic improvement,
especially in tests, and I don't think anyone will notice.
- `--edit` now uses `$VISUAL`, `$EDITOR`, or `vim`, in that order,
matching git, which I think is what most people will expect.
- Added a cute `tmptree!{}` macro, for creating temporary directories
populated with directories and files for tests.
- Admitted that grammer is LL(k) and I don't know what `k` is.
2019-11-09 21:43:20 -08:00
|
|
|
working_directory: &Path,
|
2021-05-17 20:44:12 -07:00
|
|
|
shebang: Shebang,
|
2019-07-13 01:55:06 -07:00
|
|
|
) -> Result<Command, OutputError>;
|
|
|
|
|
|
|
|
/// Set the execute permission on the file pointed to by `path`
|
|
|
|
fn set_execute_permission(path: &Path) -> Result<(), io::Error>;
|
|
|
|
|
2020-02-14 04:49:25 -08:00
|
|
|
/// Extract the signal from a process exit status, if it was terminated by a
|
|
|
|
/// signal
|
2019-07-13 01:55:06 -07:00
|
|
|
fn signal_from_exit_status(exit_status: process::ExitStatus) -> Option<i32>;
|
|
|
|
|
2020-02-14 04:49:25 -08:00
|
|
|
/// Translate a path from a "native" path to a path the interpreter expects
|
2021-02-15 01:18:31 -08:00
|
|
|
fn convert_native_path(working_directory: &Path, path: &Path) -> Result<String, String>;
|
2019-07-13 01:55:06 -07:00
|
|
|
}
|