Process(現行プロセス)
Plugin 説明内容の英語表記部分について Plugin の各章は、原文データからページ内容の一部が自動生成されているため、英語表記のままの部分があります。
このプラグインは、現在のプロセスにアクセスするための API を提供します。子プロセスを生成するには、shellプラグインを参照してください。
This plugin requires a Rust version of at least 1.77.2
| Platform | Level | Notes |
|---|---|---|
| windows | ||
| linux | ||
| macos | ||
| android | | |
| ios | |
はじめに、「process」プラグインをインストールしてください。
自分のプロジェクトのパッケージ・マネージャーを使用して依存関係を追加します:
npm run tauri add processyarn run tauri add processpnpm tauri add processdeno task tauri add processbun tauri add processcargo tauri add process-
src-tauriフォルダで次のコマンドを実行して、このプラグインをCargo.toml内のプロジェクトの依存関係に追加します:cargo add tauri-plugin-process -
追加したプラグインを初期化するために
lib.rsを修正します:src-tauri/src/lib.rs #[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {tauri::Builder::default().plugin(tauri_plugin_process::init()).run(tauri::generate_context!()).expect("error while running tauri application");} -
JavaScript でこのプラグインを使用する場合は、npm パッケージもインストールしてください:
npm install @tauri-apps/plugin-processyarn add @tauri-apps/plugin-processpnpm add @tauri-apps/plugin-processdeno add npm:@tauri-apps/plugin-processbun add @tauri-apps/plugin-process
「process」プラグインは、JavaScript と Rust の両方で利用できます。
import { exit, relaunch } from '@tauri-apps/plugin-process';// `"withGlobalTauri": true` を使用する場合は、// const { exit, relaunch } = window.__TAURI__.process; を使用できます
// 指定されたステータス・コードでアプリを終了await exit(0);
// アプリを再起動await relaunch();app は AppHandle のインスタンスであることに注意してください。
// 指定されたステータス・コードでアプリを終了app.exit(0);
// アプリを再起動app.restart();デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、capabilities 設定でアクセス権限を変更する必要があります。
詳細については「セキュリティ・レベル Capabilities」の章を参照してください。また、プラグインのアクセス権限を設定するには「プライグン・アクセス権の使用」の章のステップ・バイ・ステップ・ガイドを参照してください。
{ "permissions": [ ..., "process:default", ]}Default Permission
This permission set configures which process features are by default exposed.
Granted Permissions
This enables to quit via allow-exit and restart via allow-restart
the application.
This default permission set includes the following:
allow-exitallow-restart
Permission Table
| Identifier | Description |
|---|---|
|
|
Enables the exit command without any pre-configured scope. |
|
|
Denies the exit command without any pre-configured scope. |
|
|
Enables the restart command without any pre-configured scope. |
|
|
Denies the restart command without any pre-configured scope. |
【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】
© 2025 Tauri Contributors. CC-BY / MIT