Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Fix: truffle unbox use spawnSync to run the post-install hook #5765

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/box/lib/utils/unbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function installBoxDependencies({ hooks }: boxConfig, destination: string) {
const postUnpack = hooks["post-unpack"];

if (postUnpack.length === 0) return;
execSync(postUnpack, { cwd: destination });
execSync(postUnpack, { cwd: destination, stdio: "ignore" });
Copy link
Contributor

Choose a reason for hiding this comment

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

Would increasing maxBuffer be better? Ignoring stdio altogether hides warnings.

Or use spawn instead of exec.

Copy link
Member

Choose a reason for hiding this comment

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

Would prefer using spawn to get around the buffer issue. Thanks, @cliffoo

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review ! I'll push an update using spawn tomorrow 😃

Copy link
Member

Choose a reason for hiding this comment

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

Hey @GuillaumeRx, the move to spawn has to make sure we don't break other boxes that use complex commands as well as parsing hooks.post-unpack because spawn and execSync APIs describe a utility's command and its arguments differently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like parsing can be avoided by setting shell to true (gist)

Copy link
Author

Choose a reason for hiding this comment

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

execSync will only output stderr to the parent process stderr. Should I replicate this behaviour with spawn ?

}

export = {
Expand Down