@nu-art/commando 0.204.74 → 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 +1 -0
- package/core/cli.js +7 -0
- package/package.json +1 -1
package/core/cli.d.ts
CHANGED
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
|
}
|