ic-mops 1.7.1 → 1.7.2

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.
@@ -132,20 +132,31 @@ export class Replica {
132
132
  async stop(sigint = false) {
133
133
  if (this.type === 'dfx' || this.type === 'dfx-pocket-ic') {
134
134
  if (this.dfxProcess) {
135
- this.dfxProcess.kill();
135
+ let killed = this.dfxProcess.kill();
136
+
137
+ if (!killed) {
138
+ this.dfxProcess.kill('SIGKILL');
139
+ }
140
+
136
141
  // give replica some time to stop
137
- await new Promise((resolve) => {
138
- setTimeout(resolve, 1000);
139
- });
140
- }
142
+ let i = 0;
143
+ while (this.dfxProcess.exitCode === null) {
144
+ i++;
145
+ await new Promise((resolve) => {
146
+ setTimeout(resolve, 500);
147
+ });
148
+ if (i >= 20) {
149
+ break;
150
+ }
151
+ }
141
152
 
142
- // if (!this.dfxProcess) {
143
- // try {
144
- // execSync('dfx killall', {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
145
- // execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), {cwd: this.dir, timeout: 10_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
146
- // }
147
- // catch {}
148
- // }
153
+ // // make sure replica is stopped
154
+ // try {
155
+ // // execSync('dfx killall', {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
156
+ // execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
157
+ // }
158
+ // catch {}
159
+ }
149
160
  }
150
161
  else if (this.pocketIc && this.pocketIcServer) {
151
162
  if (!sigint) {
@@ -103,19 +103,28 @@ export class Replica {
103
103
  async stop(sigint = false) {
104
104
  if (this.type === 'dfx' || this.type === 'dfx-pocket-ic') {
105
105
  if (this.dfxProcess) {
106
- this.dfxProcess.kill();
106
+ let killed = this.dfxProcess.kill();
107
+ if (!killed) {
108
+ this.dfxProcess.kill('SIGKILL');
109
+ }
107
110
  // give replica some time to stop
108
- await new Promise((resolve) => {
109
- setTimeout(resolve, 1000);
110
- });
111
+ let i = 0;
112
+ while (this.dfxProcess.exitCode === null) {
113
+ i++;
114
+ await new Promise((resolve) => {
115
+ setTimeout(resolve, 500);
116
+ });
117
+ if (i >= 20) {
118
+ break;
119
+ }
120
+ }
121
+ // // make sure replica is stopped
122
+ // try {
123
+ // // execSync('dfx killall', {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
124
+ // execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
125
+ // }
126
+ // catch {}
111
127
  }
112
- // if (!this.dfxProcess) {
113
- // try {
114
- // execSync('dfx killall', {cwd: this.dir, timeout: 3_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
115
- // execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), {cwd: this.dir, timeout: 10_000, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
116
- // }
117
- // catch {}
118
- // }
119
128
  }
120
129
  else if (this.pocketIc && this.pocketIcServer) {
121
130
  if (!sigint) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
package/bundle/cli.tgz DELETED
Binary file