File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nerdctl" ,
3- "version" : " 0.1.3 " ,
3+ "version" : " 0.1.4 " ,
44 "main" : " dist/index.js" ,
55 "types" : " dist/index.d.ts" ,
66 "description" : " Node wrapper for nerdctl" ,
Original file line number Diff line number Diff line change @@ -4,16 +4,35 @@ import {
44 RunCommandFlags ,
55 StopCommandFlags ,
66} from "@/types/container" ;
7+ import { ShellString , which } from "shelljs" ;
78
89import BaseBackend from "./base" ;
910import { ChildProcess } from "child_process" ;
1011import { ImageResult } from "@/types/images" ;
1112import { LimaListResult } from "@/types/lima" ;
1213import { LoginCommandFlags } from "@/types/registry" ;
13- import { ShellString } from "shelljs" ;
1414
1515export default class LimaBackend extends BaseBackend {
1616 async initVM ( ) : Promise < boolean > {
17+ if ( ! which ( "brew" ) ) return false ;
18+ if ( ! which ( this . vm ) ) {
19+ const child = ( await this . exec ( `brew install lima` ) ) as ChildProcess ;
20+ await new Promise ( ( resolve , reject ) => {
21+ child ?. stdout ?. on ( "data" , ( data ) => {
22+ console . log ( data ) ;
23+ } ) ;
24+ child ?. stdout ?. on ( "close" , ( ) => {
25+ resolve ( true ) ;
26+ } ) ;
27+ child ?. stderr ?. on ( "data" , ( data ) => {
28+ console . log ( data ) ;
29+ } ) ;
30+ child ?. stderr ?. on ( "close" , ( ) => {
31+ reject ( false ) ;
32+ } ) ;
33+ } ) ;
34+ }
35+
1736 const listChild = ( await this . exec (
1837 `${ this . vm } list --json`
1938 ) ) as ChildProcess ;
You can’t perform that action at this time.
0 commit comments