Allow arguments for Snap apps
This commit is contained in:
parent
0f837e26d6
commit
74e54a016c
4 changed files with 10 additions and 3 deletions
|
|
@ -35,6 +35,9 @@ pub enum EntryKind {
|
||||||
/// Command to run (defaults to snap_name if not specified)
|
/// Command to run (defaults to snap_name if not specified)
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
command: Option<String>,
|
command: Option<String>,
|
||||||
|
/// Additional command-line arguments
|
||||||
|
#[serde(default)]
|
||||||
|
args: Vec<String>,
|
||||||
/// Additional environment variables
|
/// Additional environment variables
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
env: HashMap<String, String>,
|
env: HashMap<String, String>,
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ pub struct LimitsPolicy {
|
||||||
fn convert_entry_kind(raw: RawEntryKind) -> EntryKind {
|
fn convert_entry_kind(raw: RawEntryKind) -> EntryKind {
|
||||||
match raw {
|
match raw {
|
||||||
RawEntryKind::Process { argv, env, cwd } => EntryKind::Process { argv, env, cwd },
|
RawEntryKind::Process { argv, env, cwd } => EntryKind::Process { argv, env, cwd },
|
||||||
RawEntryKind::Snap { snap_name, command, env } => EntryKind::Snap { snap_name, command, env },
|
RawEntryKind::Snap { snap_name, command, args, env } => EntryKind::Snap { snap_name, command, args, env },
|
||||||
RawEntryKind::Vm { driver, args } => EntryKind::Vm { driver, args },
|
RawEntryKind::Vm { driver, args } => EntryKind::Vm { driver, args },
|
||||||
RawEntryKind::Media { library_id, args } => EntryKind::Media { library_id, args },
|
RawEntryKind::Media { library_id, args } => EntryKind::Media { library_id, args },
|
||||||
RawEntryKind::Custom { type_name, payload } => EntryKind::Custom {
|
RawEntryKind::Custom { type_name, payload } => EntryKind::Custom {
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,9 @@ pub enum RawEntryKind {
|
||||||
snap_name: String,
|
snap_name: String,
|
||||||
/// Command to run (defaults to snap_name if not specified)
|
/// Command to run (defaults to snap_name if not specified)
|
||||||
command: Option<String>,
|
command: Option<String>,
|
||||||
|
/// Additional command-line arguments
|
||||||
|
#[serde(default)]
|
||||||
|
args: Vec<String>,
|
||||||
/// Additional environment variables
|
/// Additional environment variables
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
env: HashMap<String, String>,
|
env: HashMap<String, String>,
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,11 @@ impl HostAdapter for LinuxHost {
|
||||||
EntryKind::Process { argv, env, cwd } => {
|
EntryKind::Process { argv, env, cwd } => {
|
||||||
(argv.clone(), env.clone(), cwd.clone(), None)
|
(argv.clone(), env.clone(), cwd.clone(), None)
|
||||||
}
|
}
|
||||||
EntryKind::Snap { snap_name, command, env } => {
|
EntryKind::Snap { snap_name, command, args, env } => {
|
||||||
// For snap apps, the command defaults to the snap name
|
// For snap apps, the command defaults to the snap name
|
||||||
let cmd = command.clone().unwrap_or_else(|| snap_name.clone());
|
let cmd = command.clone().unwrap_or_else(|| snap_name.clone());
|
||||||
let argv = vec![cmd];
|
let mut argv = vec![cmd];
|
||||||
|
argv.extend(args.clone());
|
||||||
(argv, env.clone(), None, Some(snap_name.clone()))
|
(argv, env.clone(), None, Some(snap_name.clone()))
|
||||||
}
|
}
|
||||||
EntryKind::Vm { driver, args } => {
|
EntryKind::Vm { driver, args } => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue