start-command 0.30.0 → 0.30.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # start-command
2
2
 
3
+ ## 0.30.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1a040d6: Use `docker stop` for detached Docker `--stop` control so containers follow Docker's graceful stop lifecycle instead of receiving a raw `SIGINT`.
8
+
3
9
  ## 0.30.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "start-command",
3
- "version": "0.30.0",
3
+ "version": "0.30.1",
4
4
  "description": "Gamification of coding, execute any command with ability to auto-report issues on GitHub",
5
5
  "main": "src/bin/cli.js",
6
6
  "exports": {
@@ -30,7 +30,7 @@
30
30
  * --list List all tracked command executions
31
31
  * --upload-log <uuid-or-session> Upload the stored log for a tracked execution
32
32
  * --output-format <format> Output format for status/list (links-notation, json, text)
33
- * --stop <uuid-or-session-name> Send CTRL+C/SIGINT to a detached execution
33
+ * --stop <uuid-or-session-name> Ask a detached execution to stop gracefully
34
34
  * --terminate <uuid-or-session-name> Terminate a detached execution immediately
35
35
  * --cleanup Clean up stale "executing" records (processes that crashed or were killed)
36
36
  * --cleanup-dry-run Show stale records that would be cleaned up (without actually cleaning)
@@ -197,9 +197,9 @@ function getControlCommand(record, action) {
197
197
  case 'docker':
198
198
  return {
199
199
  command: 'docker',
200
- args: ['kill', '--signal=SIGINT', sessionName],
201
- method: 'SIGINT',
202
- message: `Sent SIGINT to detached docker container: ${sessionName}`,
200
+ args: ['stop', sessionName],
201
+ method: 'DOCKER_STOP',
202
+ message: `Requested graceful stop for detached docker container: ${sessionName}`,
203
203
  };
204
204
  default:
205
205
  return {
package/src/lib/usage.js CHANGED
@@ -27,7 +27,7 @@ Options:
27
27
  --status <id> Show status of execution by UUID or session name (--output-format: links-notation|json|text)
28
28
  --list List all tracked executions (--output-format: links-notation|json|text)
29
29
  --upload-log <id> Upload the stored log for an execution UUID or session name
30
- --stop <id> Send CTRL+C/SIGINT to a detached isolated execution
30
+ --stop <id> Ask a detached isolated execution to stop gracefully
31
31
  --terminate <id> Terminate a detached isolated execution immediately
32
32
  --cleanup Clean up stale "executing" records (crashed/killed processes)
33
33
  --cleanup-dry-run Show stale records that would be cleaned up (without cleaning)
@@ -136,6 +136,46 @@ describe('execution control', () => {
136
136
  });
137
137
  });
138
138
 
139
+ it('should stop a detached docker container with docker stop', () => {
140
+ const store = createStore();
141
+ store.save(
142
+ createDetachedRecord({
143
+ uuid: 'docker-control-uuid',
144
+ options: {
145
+ isolated: 'docker',
146
+ isolationMode: 'detached',
147
+ sessionName: 'docker-session',
148
+ containerId: 'abc123',
149
+ },
150
+ })
151
+ );
152
+ const runner = createRunner({
153
+ 'docker inspect -f {{.Id}} {{.State.Pid}} docker-session': {
154
+ success: true,
155
+ stdout: 'abcdef 0\n',
156
+ stderr: '',
157
+ status: 0,
158
+ error: null,
159
+ },
160
+ });
161
+
162
+ const result = controlExecution(
163
+ store,
164
+ 'docker-control-uuid',
165
+ ControlAction.STOP,
166
+ runner
167
+ );
168
+
169
+ assert.strictEqual(result.success, true);
170
+ assert.match(result.output, /action stop/);
171
+ assert.match(result.output, /method DOCKER_STOP/);
172
+ assert.match(result.output, /containerId abcdef/);
173
+ assert.deepStrictEqual(runner.calls[0], {
174
+ command: 'docker',
175
+ args: ['stop', 'docker-session'],
176
+ });
177
+ });
178
+
139
179
  it('should send docker terminate through docker kill', () => {
140
180
  const store = createStore();
141
181
  store.save(