mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-21 17:51:36 +03:00
2681ad361b
Co-authored-by: Quentin Goinaud <armaldio@gmail.com> Co-authored-by: Lucas Fernandes Nogueira <lucasfernandesnog@gmail.com> Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
25 lines
510 B
TypeScript
25 lines
510 B
TypeScript
import { promisified } from './tauri'
|
|
|
|
/**
|
|
* spawns a process
|
|
*
|
|
* @param command the name of the cmd to execute e.g. 'mkdir' or 'node'
|
|
* @param [args] command args
|
|
* @return promise resolving to the stdout text
|
|
*/
|
|
async function execute(command: string, args?: string | string[]): Promise<string> {
|
|
if (typeof args === 'object') {
|
|
Object.freeze(args)
|
|
}
|
|
|
|
return await promisified({
|
|
cmd: 'execute',
|
|
command,
|
|
args: typeof args === 'string' ? [args] : args
|
|
})
|
|
}
|
|
|
|
export {
|
|
execute
|
|
}
|