#Execute anything with .spawn() with shell plugin.

15 messages · Page 1 of 1 (latest)

hollow idol
#

I'm developing a game launcher and I need to execute every single version of the game with the shell plugin.

Some versions need a command like Game --dataPath="", or like /path/to/dotnet Game.dll or even like mono Game.dll + I want to allow custom wrappers for thinks like gamemoderun and so on.

What's the problem? Permissions. Tauri is great speaking about security but this may be an issue here.
Is there any allow-execute-all or something like that?
If don't, can I at least create a run.sh or whatever on each instance folder, edit the content to it execute the game with whatever I need and then run that file?

hollow idol
#

Execute anything with .spawn() with shell plugin.

hollow idol
#

After thinking about this fro some time, is there any restriction when running commands on the backend?

#

I can make an IPC to run the game and return the PID to the front and then maybe, if there's a way to do so, conect to that process and get the stdin and stdout of that process?

#

The problem si that I need to execute commands on the console of that process

#

To execute server commands from a "console" I'll render on the front

#

This can't be done using the .sh option neither...

#

Ok I'm fucked I think

blissful niche
#

And what you're thinking about is in theory possible, this is exactly how tauri's shell plugin works. It's implemented in rust as well with a small js layer sending/receiving data from the command spawned on the rust side.

#

using bash / cmd.exe as the actual command with args: true is a common workaround, so you were right with that idea as well

hollow idol
#

If you meant that. You said what I was thinking is possible but I don't know if you meant the get by PID or the create a file and use it xD

blissful niche
#

Neither, i meant more like the general ideas.

  • For the PID thing: Remember, your frontend is inside the browser's sandbox so you can't connect to any outside processes from js directly. What i meant is that you spawn the Command on the rust side and use tauri's event system to send/receive stdio to/from the frontend.
  • For the file thing: No need for a file if all you want is freedom from the permissions. Use sh or something as the Command so you end up with sh /c the-actual-command