11/*
2- © Copyright IBM Corporation 2018, 2019
2+ © Copyright IBM Corporation 2018, 2022
33
44Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ limitations under the License.
1818package ready
1919
2020import (
21+ "context"
2122 "io/ioutil"
2223 "os"
2324 "strings"
@@ -67,22 +68,22 @@ func Check() (bool, error) {
6768}
6869
6970// IsRunningAsActiveQM returns true if the queue manager is running in active mode
70- func IsRunningAsActiveQM (name string ) (bool , error ) {
71- return isRunningQM (name , "(RUNNING)" )
71+ func IsRunningAsActiveQM (ctx context. Context , name string ) (bool , error ) {
72+ return isRunningQM (ctx , name , "(RUNNING)" )
7273}
7374
7475// IsRunningAsStandbyQM returns true if the queue manager is running in standby mode
75- func IsRunningAsStandbyQM (name string ) (bool , error ) {
76- return isRunningQM (name , "(RUNNING AS STANDBY)" )
76+ func IsRunningAsStandbyQM (ctx context. Context , name string ) (bool , error ) {
77+ return isRunningQM (ctx , name , "(RUNNING AS STANDBY)" )
7778}
7879
7980// IsRunningAsReplicaQM returns true if the queue manager is running in replica mode
80- func IsRunningAsReplicaQM (name string ) (bool , error ) {
81- return isRunningQM (name , "(REPLICA)" )
81+ func IsRunningAsReplicaQM (ctx context. Context , name string ) (bool , error ) {
82+ return isRunningQM (ctx , name , "(REPLICA)" )
8283}
8384
84- func isRunningQM (name string , status string ) (bool , error ) {
85- out , _ , err := command .Run ( "dspmq" , "-n" , "-m" , name )
85+ func isRunningQM (ctx context. Context , name string , status string ) (bool , error ) {
86+ out , _ , err := command .RunContext ( ctx , "dspmq" , "-n" , "-m" , name )
8687 if err != nil {
8788 return false , err
8889 }
0 commit comments