Socket
Socket
Sign inDemoInstall

@tauri-apps/api

Package Overview
Dependencies
Maintainers
0
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tauri-apps/api - npm Package Compare versions

Comparing version 1.5.6 to 1.6.0

10

CHANGELOG.md
# Changelog
## \[1.6.0]
### Enhancements
- [`44e3335da`](https://www.github.com/tauri-apps/tauri/commit/44e3335da8c1a811a2ebe72f2036dfad2381da24) ([#9796](https://www.github.com/tauri-apps/tauri/pull/9796)) Enhance the speed of The JS `Command.execute` API from `shell` module.
### Bug Fixes
- [`44e3335da`](https://www.github.com/tauri-apps/tauri/commit/44e3335da8c1a811a2ebe72f2036dfad2381da24) ([#9796](https://www.github.com/tauri-apps/tauri/pull/9796)) Fix The JS `Command.execute` API from `shell` module including extra new lines.
## \[1.5.6]

@@ -4,0 +14,0 @@

2

package.json
{
"name": "@tauri-apps/api",
"version": "1.5.6",
"version": "1.6.0",
"description": "Tauri API definitions",

@@ -5,0 +5,0 @@ "funding": {

@@ -82,27 +82,2 @@ import { invokeTauriCommand } from './helpers/tauri.js';

/**
* Spawns a process.
*
* @ignore
* @param program The name of the scoped command.
* @param onEvent Event handler.
* @param args Program arguments.
* @param options Configuration for the process spawn.
* @returns A promise resolving to the process id.
*/
async function execute(onEvent, program, args = [], options) {
if (typeof args === 'object') {
Object.freeze(args);
}
return invokeTauriCommand({
__tauriModule: 'Shell',
message: {
cmd: 'execute',
program,
args,
options,
onEventFn: transformCallback(onEvent)
}
});
}
/**
* @since 1.0.0

@@ -378,3 +353,9 @@ */

async spawn() {
return execute((event) => {
const program = this.program;
const args = this.args;
const options = this.options;
if (typeof args === 'object') {
Object.freeze(args);
}
const onEvent = (event) => {
switch (event.event) {

@@ -394,3 +375,13 @@ case 'Error':

}
}, this.program, this.args, this.options).then((pid) => new Child(pid));
};
return invokeTauriCommand({
__tauriModule: 'Shell',
message: {
cmd: 'execute',
program,
args,
options,
onEventFn: transformCallback(onEvent)
}
}).then((pid) => new Child(pid));
}

@@ -412,21 +403,16 @@ /**

async execute() {
return new Promise((resolve, reject) => {
this.on('error', reject);
const stdout = [];
const stderr = [];
this.stdout.on('data', (line) => {
stdout.push(line);
});
this.stderr.on('data', (line) => {
stderr.push(line);
});
this.on('close', (payload) => {
resolve({
code: payload.code,
signal: payload.signal,
stdout: stdout.join('\n'),
stderr: stderr.join('\n')
});
});
this.spawn().catch(reject);
const program = this.program;
const args = this.args;
const options = this.options;
if (typeof args === 'object') {
Object.freeze(args);
}
return invokeTauriCommand({
__tauriModule: 'Shell',
message: {
cmd: 'executeAndReturn',
program,
args,
options
}
});

@@ -433,0 +419,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc