I am building snap from command line program to guess linux commands from natural language. For example cal
for show calendar
. When command is proposed I need to confirm them by Enter
. So after Enter
I expect to execute cal
on my host system.
I works when program is executed natively on host machine thanks to the following code:
let mut child = Command::new(command_name)
.args(command_args)
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.spawn()
.expect("Failed to execute command");
but when i packaged this app into snap
i seen error:
➜ gpt-cli show calendar
> Execute.:
cal
Yes
thread 'main' panicked at 'Failed to execute command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/main.rs:126:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I afraid that cal
is not available on snap container
and my program does not have access to host context.
So question is: can i give access to snap app to execute programs on host?
I was checking interfaces but not found nothing connected with access to host programs.
snapcraft.yaml
Update
I found solution:
Firstly I needed process-control
apps:
gpt-cli:
command: gpt-cli
plugs:
- process-control
- network
- network-bind
and
confinement: classic