Interface IShellInternal

interface IShellInternal {
    open: (path: string, openWith?: string) => Promise<void>;
    execute(
        program: string,
        args: string[],
        options: InternalSpawnOptions,
    ): Promise<ChildProcess<IOPayload>>;
    kill(pid: number): Promise<void>;
    rawSpawn<O extends IOPayload>(
        program: string,
        args: string[],
        options: InternalSpawnOptions,
        cb: (evt: CommandEvent<O>) => void,
    ): Promise<number>;
    stdinWrite(buffer: string | number[], pid: number): Promise<void>;
}

Properties

Methods

Properties

open: (path: string, openWith?: string) => Promise<void>

Type declaration

    • (path: string, openWith?: string): Promise<void>
    • Opens a path or URL with the system's default app, or the one specified with openWith.

      The openWith value must be one of firefox, google chrome, chromium safari, open, start, xdg-open, gio, gnome-open, kde-open or wslview.

      Parameters

      • path: string

        The path or URL to open. This value is matched against the string regex defined on tauri.conf.json > plugins > shell > open, which defaults to ^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+.

      • OptionalopenWith: string

        The app to open the file or URL with. Defaults to the system default application for the specified path type.

      Returns Promise<void>

      import { open } from '@tauri-apps/plugin-shell';
      // opens the given URL on the default browser:
      await open('https://github.com/tauri-apps/tauri');
      // opens the given URL using `firefox`:
      await open('https://github.com/tauri-apps/tauri', 'firefox');
      // opens a file using the default program:
      await open('/path/to/file');

      2.0.0

Methods

  • Parameters

    • program: string
    • args: string[]
    • options: InternalSpawnOptions

    Returns Promise<ChildProcess<IOPayload>>

  • Type Parameters

    • O extends IOPayload

    Parameters

    • program: string
    • args: string[]
    • options: InternalSpawnOptions
    • cb: (evt: CommandEvent<O>) => void

    Returns Promise<number>