feat: v1.1.2, support runts sign

This commit is contained in:
2025-01-24 00:48:57 +08:00
parent 35a7972673
commit 47677f4705
8 changed files with 45 additions and 6 deletions

24
src/run_ts.rs Normal file
View File

@@ -0,0 +1,24 @@
use crate::{verify, RunScriptArgs};
use rust_util::util_cmd;
use rust_util::util_env::is_env_on;
use std::process::Command;
pub fn do_run_script(ts_args: &RunScriptArgs) {
if ts_args.arguments.is_empty() {
failure_and_exit!("Must assign a script file name");
}
debugging!("Run ts args: {:?}", ts_args.arguments);
let script_file = &ts_args.arguments[ts_args.arguments.len() - 1];
verify::verify_script(script_file, is_env_on("RUNTS_SKIP_VERIFY"));
let mut cmd = Command::new("/usr/bin/env");
cmd.args(["-S", "deno", "run"]);
for arg in &ts_args.arguments {
cmd.arg(arg);
}
debugging!("Run command: {cmd:?}");
if let Err(e) = util_cmd::run_command_and_wait(&mut cmd) {
failure_and_exit!("Run deno: {script_file} failed: {e}");
}
}