@@ -21,6 +21,7 @@ pub fn start<S: AsRef<OsStr>>(
2121 entrypoint : & str ,
2222 args : Vec < S > ,
2323) -> Result < ExitStatus > {
24+ // This should use the `install.meta`, not the Repositories package
2425 let package_manifest =
2526 repo:: get_package ( repo_path, package_id) . with_context ( || "Failed to get package" ) ?;
2627 let installed_path = & repo_path. join ( "installed" ) . join ( package_id) ;
@@ -29,28 +30,29 @@ pub fn start<S: AsRef<OsStr>>(
2930 let matches: Vec < & PathBuf > = package_manifest
3031 . commands
3132 . iter ( )
32- . filter ( |package| package . ends_with ( entrypoint) )
33+ . filter ( |command| command . ends_with ( entrypoint) )
3334 . collect ( ) ;
3435
3536 // Make sure theres at least a single match
36- if matches. is_empty ( ) {
37- bail ! ( "Entrypoint does not exist." )
38- }
39-
40- // Install if not installed
41- if !installed_path. exists ( ) {
42- install ( repo_path, package_id) ?;
43- }
37+ if let Some ( entrypoint) = matches. first ( ) {
38+ // Install if not installed
39+ if !installed_path. exists ( ) {
40+ install ( repo_path, package_id) . with_context ( || "Failed to install package." ) ?;
41+ }
4442
45- // Allow build_manifests to have a / at the start of entrypoints, eg: /bin/bash
46- let entrypoint = entrypoint. trim_start_matches ( '/' ) ;
43+ // Allow build_manifests to have a / at the start of entrypoints, eg: /bin/bash
44+ let entrypoint = entrypoint. to_string_lossy ( ) ;
45+ let entrypoint: & str = entrypoint. trim_start_matches ( '/' ) ;
4746
48- // Actually run the command
49- let status = Command :: new ( installed_path. join ( entrypoint) )
50- . args ( args)
51- . status ( ) ?;
47+ // Actually run the command
48+ let status = Command :: new ( installed_path. join ( entrypoint) )
49+ . args ( args)
50+ . status ( ) ?;
5251
53- Ok ( status)
52+ Ok ( status)
53+ } else {
54+ bail ! ( "Entrypoint does not exist." )
55+ }
5456}
5557
5658/// Installs or Updates a Package.
0 commit comments