1
This commit is contained in:
@@ -26,6 +26,7 @@ use serde_json::Value;
|
||||
use tauri::{AppHandle, Emitter, Window};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
use crate::app_config::AppConfig;
|
||||
use crate::js_runtime::PipelineEvent;
|
||||
use crate::nodejs;
|
||||
|
||||
@@ -80,13 +81,15 @@ fn spawn_event_pump(
|
||||
pub async fn run_nodejs_script(
|
||||
app: AppHandle,
|
||||
window: Window,
|
||||
app_config: tauri::State<'_, AppConfig>,
|
||||
script_name: String,
|
||||
params: Value,
|
||||
) -> Result<Value, String> {
|
||||
let (tx, rx) = mpsc::unbounded_channel::<PipelineEvent>();
|
||||
let pump = spawn_event_pump(app, window, script_name.clone(), rx);
|
||||
let config_env = app_config.env_for_node().await;
|
||||
|
||||
let result = nodejs::run_node_script(script_name, params, tx)
|
||||
let result = nodejs::run_node_script(script_name, params, tx, config_env)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
@@ -99,13 +102,15 @@ pub async fn run_nodejs_script(
|
||||
pub async fn run_nodejs_script_source(
|
||||
app: AppHandle,
|
||||
window: Window,
|
||||
app_config: tauri::State<'_, AppConfig>,
|
||||
script_source: String,
|
||||
params: Value,
|
||||
) -> Result<Value, String> {
|
||||
let (tx, rx) = mpsc::unbounded_channel::<PipelineEvent>();
|
||||
let pump = spawn_event_pump(app, window, "<debug-source>".to_string(), rx);
|
||||
let config_env = app_config.env_for_node().await;
|
||||
|
||||
let result = nodejs::run_node_script_source(script_source, params, tx)
|
||||
let result = nodejs::run_node_script_source(script_source, params, tx, config_env)
|
||||
.await
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user