bdy 1.18.31-stage → 1.18.32-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.18.31-stage",
4
+ "version": "1.18.32-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -2,22 +2,23 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const utils_1 = require("../utils");
4
4
  const waitUntilAgentEnabled = async (api, timeout, onTimeout, onSuccess) => {
5
- let s;
6
- try {
7
- s = await api.fetchStatus();
8
- }
9
- catch {
10
- s = {};
11
- }
12
- if (s.enabled) {
13
- onSuccess();
14
- }
15
- else if (timeout < 1000) {
16
- onTimeout();
17
- }
18
- else {
19
- await (0, utils_1.sleep)(1000);
20
- return waitUntilAgentEnabled(api, timeout - 1000, onTimeout, onSuccess);
5
+ let remaining = timeout;
6
+ while (remaining >= 1000) {
7
+ let s;
8
+ try {
9
+ s = await api.fetchStatus();
10
+ }
11
+ catch {
12
+ s = {};
13
+ }
14
+ if (s.enabled) {
15
+ return onSuccess();
16
+ }
17
+ remaining -= 1000;
18
+ if (remaining >= 1000) {
19
+ await (0, utils_1.sleep)(1000);
20
+ }
21
21
  }
22
+ return onTimeout();
22
23
  };
23
24
  exports.default = waitUntilAgentEnabled;
@@ -117,8 +117,14 @@ class AgentWindows extends system_1.default {
117
117
  if (user && pass) {
118
118
  await this.nssm(`set bdy ObjectName ${user} ${pass}`);
119
119
  }
120
- if (start)
121
- await this.start();
120
+ if (start) {
121
+ try {
122
+ await this.start();
123
+ }
124
+ catch {
125
+ // do nothing, it will throw operation pending
126
+ }
127
+ }
122
128
  logger_1.default.info(texts_1.LOG_AGENT_ENABLED);
123
129
  }
124
130
  catch (err) {
@@ -144,6 +144,7 @@ class Output {
144
144
  }
145
145
  static killSpinner() {
146
146
  if (this.s) {
147
+ this.s.animate(0);
147
148
  this.s.destroy();
148
149
  this.s = null;
149
150
  terminal.eraseLine();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.18.31-stage",
4
+ "version": "1.18.32-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {