コンテンツにスキップ
Tauri

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 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();

デフォルトでは、潜在的に危険なプラグイン・コマンドとそのスコープ(有効範囲)はすべてブロックされており、アクセスできません。これらを有効にするには、capabilities 設定でアクセス権限を変更する必要があります。

詳細については「セキュリティ・レベル Capabilities」の章を参照してください。また、プラグインのアクセス権限を設定するには「プライグン・アクセス権の使用」の章のステップ・バイ・ステップ・ガイドを参照してください。

src-tauri/capabilities/default.json
{
"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-exit
  • allow-restart

Permission Table

Identifier Description

process:allow-exit

Enables the exit command without any pre-configured scope.

process:deny-exit

Denies the exit command without any pre-configured scope.

process:allow-restart

Enables the restart command without any pre-configured scope.

process:deny-restart

Denies the restart command without any pre-configured scope.

【※ この日本語版は、「Feb 22, 2025 英語版」に基づいています】


© 2025 Tauri Contributors. CC-BY / MIT