Open wallacerenan opened 9 months ago
Can you check if it works if you use sh
as the command binary instead of echo directly?
Can you check if it works if you use
sh
as the command binary instead of echo directly?
Any ideas on how to do this?
Change cmd in tauri.conf to "sh"
and the args from path
to ["-c", "'echo $ANDROID_HOME'"
(note that the second arg is in 2 sets of quotes, one for the rust string and one for the -c string input).
I'm on my phone so I may not remember it correctly.
Change cmd in tauri.conf to
"sh"
and the args frompath
to["-c", "'echo $ANDROID_HOME'"
(note that the second arg is in 2 sets of quotes, one for the rust string and one for the -c string input).I'm on my phone so I may not remember it correctly.
Same error here :(
{
"name": "run-sh",
"cmd": "sh",
"args": true
}
export async function getSDKPathCommand() {
const command = new Command('run-sh', "-c 'pwd'");
const output = await command.execute();
console.log(output);
return command;
}
console: result: ""
Hi @wallacerenan ,
Actually, Rust uses another approach to Command
, that is, you have to mention each argument separately.
Please read:
https://doc.rust-lang.org/std/process/struct.Command.html
So, arguments are directly passed to echo
command via args, and 1 arg
at a time, hence prevent potential Shell Injection vulnerability.
So, instead of
const command = new Command('echo', path);
You should use
const command = new Command("echo").arg("path");
Describe the bug
tauri.conf.json:
the function getSDKPathCommand
Reproduction
No response
Expected behavior
log the shell var $ANDROID_HOME (/Users/{username}/Library/Android/sdk), but it is logging: $ANDROID_HOME
Full
tauri info
outputStack trace
No response
Additional context
No response