mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 11:13:40 +03:00
fix(cli): kill beforeDevCommand
process if mobile dev command fails (#7241)
This commit is contained in:
parent
655c714e41
commit
6252380f44
6
.changes/kill-dev-process-on-err.md
Normal file
6
.changes/kill-dev-process-on-err.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Exit `beforeDevCommand` process if the android or iOS `dev` command fails.
|
@ -448,10 +448,11 @@ fn check_for_updates() -> Result<()> {
|
||||
pub fn kill_before_dev_process() {
|
||||
if let Some(child) = BEFORE_DEV.get() {
|
||||
let child = child.lock().unwrap();
|
||||
KILL_BEFORE_DEV_FLAG
|
||||
.get()
|
||||
.unwrap()
|
||||
.store(true, Ordering::Relaxed);
|
||||
let kill_before_dev_flag = KILL_BEFORE_DEV_FLAG.get().unwrap();
|
||||
if kill_before_dev_flag.load(Ordering::Relaxed) {
|
||||
return;
|
||||
}
|
||||
kill_before_dev_flag.store(true, Ordering::Relaxed);
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let powershell_path = std::env::var("SYSTEMROOT").map_or_else(
|
||||
|
@ -96,7 +96,15 @@ impl From<Options> for DevOptions {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
let result = run_command(options, noise_level);
|
||||
if result.is_err() {
|
||||
crate::dev::kill_before_dev_process();
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
delete_codegen_vars();
|
||||
|
||||
let (merge_config, _merge_config_path) = resolve_merge_config(&options.config)?;
|
||||
|
@ -83,7 +83,15 @@ impl From<Options> for DevOptions {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
let result = run_command(options, noise_level);
|
||||
if result.is_err() {
|
||||
crate::dev::kill_before_dev_process();
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
if var_os(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME).is_none() {
|
||||
if let Ok(teams) = find_development_teams() {
|
||||
let index = match teams.len() {
|
||||
|
Loading…
Reference in New Issue
Block a user