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

fix: Issue fixed for building binary with recompileFromSource #173

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

whaagmans
Copy link
Contributor

@whaagmans whaagmans commented Jul 4, 2023

This is a fix for #171 and #141.

The command in recompileFromSource passed to cp.spawnSync uses the && operator to chain multiple npm scripts together. However, && is a shell operator for command chaining and conditional execution.

cp.spawnSync expects a single command as the first argument, making it incompatible with the && operator usage. && is interpreted by the shell, not as part of a single command.

To resolve this, there are two options:

  1. Separate npm scripts into individual commands: Execute each npm script separately using cp.spawnSync. This ensures each script is treated as an independent command, eliminating the need for shell operators like &&.

  2. Execute a shell command: Invoke a shell (e.g., sh) and pass the entire chain of npm scripts with && as the argument to cp.spawnSync. However, this introduces a dependency on the shell environment and may lead to platform or shell inconsistencies.

For simplicity and cleanliness, I recommend option 1. It separates npm scripts into individual commands, aligning with cp.spawnSync requirements and improving code manageability.

Please review and let me know if you have any questions or if further adjustments are needed.

@JonasBa
Copy link
Member

JonasBa commented Jul 5, 2023

Hmm, I wonder if this is actually the root cause - I changed this recently from separate execSync commands and people still had issues. That said, the PR looks good and we'll ship a 1.0.8 asap (today), but I sense there is a problem someplace else.

@whaagmans
Copy link
Contributor Author

@JonasBa Let me know if new issues with this problem arise after this solution. Love to help it be fixed permanently.

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.

2 participants