File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ import {Docker} from '../../src/docker/docker';
20
20
21
21
const maybe = ! process . env . GITHUB_ACTIONS || ( process . env . GITHUB_ACTIONS === 'true' && process . env . ImageOS && process . env . ImageOS . startsWith ( 'ubuntu' ) ) ? describe : describe . skip ;
22
22
23
+ maybe ( 'isDaemonRunning' , ( ) => {
24
+ it ( 'checks if daemon is running' , async ( ) => {
25
+ expect ( await Docker . isDaemonRunning ( ) ) . toBe ( true ) ;
26
+ } ) ;
27
+ } ) ;
28
+
23
29
maybe ( 'pull' , ( ) => {
24
30
// prettier-ignore
25
31
test . each ( [
Original file line number Diff line number Diff line change @@ -54,6 +54,17 @@ export class Docker {
54
54
} ) ;
55
55
}
56
56
57
+ public static async isDaemonRunning ( ) : Promise < boolean > {
58
+ try {
59
+ await Docker . getExecOutput ( [ `version` ] , {
60
+ silent : true
61
+ } ) ;
62
+ return true ;
63
+ } catch ( e ) {
64
+ return false ;
65
+ }
66
+ }
67
+
57
68
public static async exec ( args ?: string [ ] , options ?: ExecOptions ) : Promise < number > {
58
69
return Exec . exec ( 'docker' , args , Docker . execOptions ( options ) ) ;
59
70
}
You can’t perform that action at this time.
0 commit comments