@nu-art/commando 0.204.75 → 0.204.76

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.
package/core/cli.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare class BaseCLI extends Logger {
51
51
  }
52
52
  export declare class CliInteractive extends BaseCLI {
53
53
  private shell;
54
+ private alive;
54
55
  constructor();
55
56
  execute: () => Promise<void>;
56
57
  endInteractive: (cb?: AsyncVoidFunction) => void;
package/core/cli.js CHANGED
@@ -95,8 +95,12 @@ class CliInteractive extends BaseCLI {
95
95
  return this.shell.kill(signal);
96
96
  };
97
97
  this.gracefullyKill = async (pid) => {
98
+ // if the shell is already dead no need to wait for kill
99
+ if (!this.alive)
100
+ return;
98
101
  return new Promise((resolve, reject) => {
99
102
  this.shell.on('exit', async (code, signal) => {
103
+ this.alive = false;
100
104
  resolve();
101
105
  });
102
106
  if (pid) {
@@ -111,6 +115,8 @@ class CliInteractive extends BaseCLI {
111
115
  detached: true,
112
116
  shell: true
113
117
  });
118
+ //set alive
119
+ this.alive = true;
114
120
  // Handle shell output (stdout)
115
121
  const printer = (data) => {
116
122
  const message = data.toString().trim();
@@ -133,6 +139,7 @@ class CliInteractive extends BaseCLI {
133
139
  this.shell.on('data', printer);
134
140
  // Handle shell exit
135
141
  this.shell.on('close', (code) => {
142
+ this.alive = false;
136
143
  this.logInfo(`child process exited with code ${code}`);
137
144
  });
138
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/commando",
3
- "version": "0.204.75",
3
+ "version": "0.204.76",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",