Skip to content

Conversation

Talador12
Copy link

  • Adds exec() method to Container class for executing commands in running containers
  • Automatic container startup and health checking - no manual state management required
  • Support for string commands, command arrays, and rich execution options
  • Configurable working directory, environment variables, and timeout
  • Comprehensive error handling with proper exit codes and timeout support
  • Returns detailed ExecResult with stdout, stderr, exit code, success flag, and duration
  • Uses HTTP communication to container's /__exec endpoint for command execution
  • Comprehensive test coverage for all execution scenarios and error cases

- Adds exec() method to Container class for executing commands in running containers
- Automatic container startup and health checking - no manual state management required
- Support for string commands, command arrays, and rich execution options
- Configurable working directory, environment variables, and timeout
- Comprehensive error handling with proper exit codes and timeout support
- Returns detailed ExecResult with stdout, stderr, exit code, success flag, and duration
- Uses HTTP communication to container's /__exec endpoint for command execution
- Comprehensive test coverage for all execution scenarios and error cases
AbortSignal.any ? AbortSignal.any(signals) : controller.signal;

// Make HTTP request to container's exec endpoint
const response = await tcpPort.fetch('http://container/__exec', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this __exec endpoint come from?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll need to rewrite this section to use the SSH integration

@Talador12
Copy link
Author

Blocked on cloudflare/workers-sdk#10582

Will update this PR when that one is merged

@Talador12
Copy link
Author

Tied to
cloudflare/containers-demos#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants