func IsActive(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-active", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	stdout = strings.TrimSuffix(stdout, "\n")
	switch stdout {
	case "inactive":
		return false, nil
	case "active":
		return true, nil
	case "failed":
		return false, nil
	case "activating":
		return false, nil
	default:
		return false, err
	}
}
// Check whether any of the specified units are active (i.e. running).
//
// Returns true if the unit is active, false if inactive or failed.
// Also returns false in an error case.
Check whether any of the specified units are active .

Returns true if the unit is active, false if inactive or failed.
Also returns false in an error case.
// Check whether any of the specified units are active ( i . e . running ) . // // Returns true if the unit is active false if inactive or failed . // Also returns false in an error case .
func IsActive(ctx context.Context, unit string, opts Options) (bool, error) {
	var args = []string{"is-active", "--system", unit}
	if opts.UserMode {
		args[1] = "--user"
	}
	stdout, _, _, err := execute(ctx, args)
	stdout = strings.TrimSuffix(stdout, "\n")
	switch stdout {
	case "inactive":
		return false, nil
	case "active":
		return true, nil
	case "failed":
		return false, nil
	case "activating":
		return false, nil
	default:
		return false, err
	}
}
func IsActive ( ctx context . Context , unit string , opts Options ) ( bool , error ) { var args = [ ] string { " " , " " , unit } if opts . UserMode { args [ 1 ] = " " } stdout , _ , _ , err := execute ( ctx , args ) stdout = strings . TrimSuffix ( stdout , " \n " ) switch stdout { case " " : return false , nil case " " : return true , nil case " " : return false , nil case " " : return false , nil default : return false , err } }
Check whether any of the specified units are active .
Check whether any of the specified units are active .