Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makes exec_auth spawn the command asynchronously #2046

Merged

Conversation

feloy
Copy link
Contributor

@feloy feloy commented Nov 22, 2024

This PR makes exec_auth calls spawn instead of spawnSync.

This is cery useful for a GUI to continue working during the plugin is executed.

Fixes #2044

@k8s-ci-robot k8s-ci-robot added the do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. label Nov 22, 2024
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2024
@feloy feloy changed the base branch from master to release-1.x November 22, 2024 17:28
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 22, 2024
src/exec_auth.ts Outdated Show resolved Hide resolved
src/exec_auth.ts Outdated Show resolved Hide resolved
src/exec_auth.ts Outdated Show resolved Hide resolved
src/exec_auth.ts Outdated Show resolved Hide resolved
src/exec_auth.ts Outdated Show resolved Hide resolved
@feloy
Copy link
Contributor Author

feloy commented Nov 23, 2024

Many thanks for your review. I've made the changes and pushed a new commit

@feloy feloy requested a review from cjihrig November 23, 2024 08:47
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

A couple of minor comments, but LGTM other than that.

src/exec_auth.ts Outdated
subprocess.stdout.setEncoding('utf8');
subprocess.stderr.setEncoding('utf8');

subprocess.stdout.on('data', (data: Buffer | string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The Buffer part of the type can be dropped now (not sure if TypeScript will complain about it though).

src/exec_auth.ts Outdated
Comment on lines 112 to 113
subprocess.stdout.on('data', (data: Buffer | string) => {
stdoutData += data.toString('utf8');
Copy link
Contributor

Choose a reason for hiding this comment

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

The toString() call should be dropped now.

src/exec_auth.ts Outdated
});

subprocess.stderr.on('data', (data) => {
stderrData += data.toString('utf8');
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here about dropping the toString().

src/exec_auth.ts Outdated

subprocess.on('error', (error) => {
savedError = error;
throw error;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure that it still makes sense to throw here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my mistake, I forgot to remove it

@feloy feloy requested a review from cjihrig November 23, 2024 16:47
@cjihrig
Copy link
Contributor

cjihrig commented Nov 23, 2024

LGTM, thanks!

@brendandburns
Copy link
Contributor

/lgtm
/approve

Thanks for the PR!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 23, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: brendandburns, feloy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 23, 2024
@k8s-ci-robot k8s-ci-robot merged commit 8e5616f into kubernetes-client:release-1.x Nov 23, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

exec_auth spawns the command synchronously
4 participants