Skip to content

chore(cli): Replace node-pty with simple interactive process - #55

Merged
so0k merged 11 commits into
open-constructs:mainfrom
jsteinich:replace_node-pty
Apr 1, 2026
Merged

so0k merged 11 commits into
open-constructs:mainfrom
jsteinich:replace_node-pty

Conversation

@jsteinich

@jsteinich jsteinich commented Mar 14, 2026 •

Copy link
Copy Markdown
Contributor

Related issue

Fixes #4

Description

  • Built a simple interactive process wrapper that makes use of cross-spawn with the inherit option for stdin
  • Replaced exiting pty-process wrapper with new interactive-process wrapper
  • Replaced direct node-pty usage with cross-spawn usage
  • Removed references to node-pty

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Comment thread test/typescript/watch/test.ts Resolved
Comment thread test/test-helper.ts Resolved
@commiterate

commiterate commented Mar 14, 2026 •

Copy link
Copy Markdown

node:child_process v. cross-spawn (since it wasn't clear to me what cross-spawn actually does from its README): sindresorhus/execa#578 (comment)

Since CDKTF was already using it (and thus CDKTN as well), this is fine in the short to medium term.

Long term I'm less sure because cross-spawn seems unmaintained and there's some concerning issues like moxystudio/node-cross-spawn#175.

I'm not completely sure which parts of cross-spawn are important to CDKTN. It looks like:

  • cdktn invocations already split arguments (e.g. spawn("cdktn", ["watch", "--auto-approve"]).
  • Using spawn(..., { shell: process.platform === 'win32' }) seems fine for this use case specifically (automatically toggles quoting/escaping and PATHEXT is handled by the Windows shell).

@jsteinich

Copy link
Copy Markdown
Contributor Author

node:child_process v. cross-spawn (since it wasn't clear to me what cross-spawn actually does from its README): sindresorhus/execa#578 (comment)

Since CDKTF was already using it (and thus CDKTN as well), this is fine in the short to medium term.

Long term I'm less sure because cross-spawn seems unmaintained and there's some concerning issues like moxystudio/node-cross-spawn#175.

I'm not completely sure which parts of cross-spawn are important to CDKTN. It looks like:

  • cdktn invocations already split arguments (e.g. spawn("cdktn", ["watch", "--auto-approve"]).
  • Using spawn(..., { shell: process.platform === 'win32' }) seems fine for this use case specifically (automatically toggles quoting/escaping and PATHEXT is handled by the Windows shell).

I used it here primarily because it was used elsewhere in the project, but I do suspect that some of the cross platform issues do come up.

At least of the portion of the Windows tests are currently disabled in CI. Would be nice to have them running before attempting to move away from cross-spawn, though I could run them locally on WIndows to check.

@commiterate

Copy link
Copy Markdown

Sounds good. Dropping cross-spawn can be tracked separately.

@jsteinich
jsteinich marked this pull request as ready for review March 29, 2026 22:36
@jsteinich
jsteinich requested a review from a team as a code owner March 29, 2026 22:36
Comment thread test/verdaccio.yaml Resolved
@so0k
so0k merged commit 46ab9fb into open-constructs:main Apr 1, 2026
429 checks passed
@commiterate commiterate mentioned this pull request Apr 1, 2026
3 tasks
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cdktn-cli: Invoke Terraform CLI with node:child_process instead of node-pty. (Bun + Deno support)

3 participants