Readonly
stderrEvent emitter for the stderr
. Emits the data
event.
Readonly
stdoutEvent emitter for the stdout
. Emits the data
event.
Alias for emitter.on(eventName, listener)
.
2.0.0
Executes the command as a child process, waiting for it to finish and collecting all of its output.
A promise resolving to the child process output.
import { Command } from '@tauri-apps/plugin-shell';
const output = await Command.create('echo', 'message').execute();
assert(output.code === 0);
assert(output.signal === null);
assert(output.stdout === 'message');
assert(output.stderr === '');
2.0.0
Returns the number of listeners listening to the event named eventName
.
2.0.0
Removes the all specified listener from the listener array for the event eventName
Returns a reference to the EventEmitter
, so that calls can be chained.
2.0.0
Adds the listener
function to the end of the listeners array for the
event named eventName
. No checks are made to see if the listener
has
already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
times.
Returns a reference to the EventEmitter
, so that calls can be chained.
2.0.0
Adds a one-timelistener
function for the event named eventName
. The
next time eventName
is triggered, this listener is removed and then invoked.
Returns a reference to the EventEmitter
, so that calls can be chained.
2.0.0
Adds the listener
function to the beginning of the listeners array for the
event named eventName
. No checks are made to see if the listener
has
already been added. Multiple calls passing the same combination of eventName
and listener
will result in the listener
being added, and called, multiple
times.
Returns a reference to the EventEmitter
, so that calls can be chained.
2.0.0
Adds a one-timelistener
function for the event named eventName
to the_beginning_ of the listeners array. The next time eventName
is triggered, this
listener is removed, and then invoked.
Returns a reference to the EventEmitter
, so that calls can be chained.
2.0.0
Removes all listeners, or those of the specified eventName.
Returns a reference to the EventEmitter
, so that calls can be chained.
Optional
event: N2.0.0
Alias for emitter.off(eventName, listener)
.
2.0.0
Static
createCreates a command to execute the given program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]import { Command } from '@tauri-apps/plugin-shell';
const command = Command.create('my-app', ['run', 'tauri']);
const output = await command.execute();
Creates a command to execute the given program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]Optional
options: SpawnOptions & { import { Command } from '@tauri-apps/plugin-shell';
const command = Command.create('my-app', ['run', 'tauri']);
const output = await command.execute();
Creates a command to execute the given program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]Optional
options: SpawnOptionsimport { Command } from '@tauri-apps/plugin-shell';
const command = Command.create('my-app', ['run', 'tauri']);
const output = await command.execute();
Static
sidecarCreates a command to execute the given sidecar program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]import { Command } from '@tauri-apps/plugin-shell';
const command = Command.sidecar('my-sidecar');
const output = await command.execute();
Creates a command to execute the given sidecar program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]Optional
options: SpawnOptions & { import { Command } from '@tauri-apps/plugin-shell';
const command = Command.sidecar('my-sidecar');
const output = await command.execute();
Creates a command to execute the given sidecar program.
The program to execute.
It must be configured on tauri.conf.json > plugins > shell > scope
.
Optional
args: string | string[]Optional
options: SpawnOptionsimport { Command } from '@tauri-apps/plugin-shell';
const command = Command.sidecar('my-sidecar');
const output = await command.execute();
The entry point for spawning child processes. It emits the
close
anderror
events.Example
Since
2.0.0