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

remove shell-quote and switch to execsync #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ethan-Arrowood
Copy link
Contributor

I noticed a bug in this when you pass a command like echo foo && next build it would fail because of the command parsing/handling. It is simply easier to use execSync instead.

cwd: componentPath,
encoding: 'utf-8',
});
const stdout = execSync(config.buildCommand, {
Copy link
Member

Choose a reason for hiding this comment

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

Might be worth noting that if there is any stderr from a build execution that succeeds (return code of 0), that stderr will be piped to process stderr, but I don't know if it will make it into the logs. Probably not a big deal though, hopefully there isn't much stderr in builds that succeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we collect stderr and then log it manually in that case?

Copy link
Member

Choose a reason for hiding this comment

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

Taking a step back, I know this PR didn't change this to sync, and I first I was thinking this just ran on startup, but I think this build does actually run when there is a deploy component operation on any of the standard worker threads (https://github.com/HarperDB/harperdb/blob/main/components/operations.js#L427). Consequently, I think this should really all be executing asynchronously. As a general rule, once a thread is serving (HTTP or otherwise) requests, we want to avoid any execution that pauses the event loop for more than probably ~10ms. And I think this build can definitely take much longer than that. So I think we should probably use the async exec, which I believe has its own system for handling stdio.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay I'll see what I can do

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