Added 'do' support for unix systems.

This commit is contained in:
Samuel Guerra 2021-03-02 22:34:51 -03:00
parent ece0717d96
commit 4479e3120b
3 changed files with 15 additions and 3 deletions

2
do.bat
View File

@ -1,6 +1,4 @@
@echo off
set errorlevel=0
:: Bypass "Terminate Batch Job" prompt.
if "%~1"=="-FIXED_CTRL_C" (
:: Remove the -FIXED_CTRL_C parameter

6
do.sh Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Run Task
DO_NAME=do
DO_MANIFEST_PATH=tools/do-tasks/Cargo.toml
cargo run --manifest_path $DO_MANIFEST_PATH --release --quiet -- $*

View File

@ -65,6 +65,9 @@ pub fn cmd_external(cmd: &str, default_args: &[&str], user_args: &[&str]) {
#[cfg(windows)]
{
// We use ping to cause a slight delay that gives time for the current
// executable to close because the subsequent command is expected to affect
// the current executable file.
Command::new("cmd")
.args(&["/C", "ping", "localhost", "-n", "3", ">", "nul", "&"])
.arg(cmd)
@ -72,9 +75,14 @@ pub fn cmd_external(cmd: &str, default_args: &[&str], user_args: &[&str]) {
.spawn()
.ok();
}
#[cfg(not(windows))]
{
todo!("cmd_external only implemented in windows")
// We assume that if not on Windows we are in a Unix based system.
//
// We don't need a delay in Unix because it naturally permits repointing
// or removing a file name without affecting the current running file.
self::cmd(cmd, default_args, user_args);
}
}