aws / aws-toolkit-azure-devops

AWS Toolkit for Azure DevOps
Other
235 stars 100 forks source link

Use shell for execFileSync during extension packaging #552

Closed rbbarad closed 1 month ago

rbbarad commented 1 month ago

Use shell for execFileSync during extension packaging

Problem

A recent node update (~3 weeks ago) has introduced an issue with spawnSync (execFileSync) on Windows. An issue has been filed for this here https://github.com/nodejs/node/issues/52554.

This is affecting our packageExtension step (locally, Windows, Node v20.12.2), giving the following error:

Creating deployment vsix
Packaging with:C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\node_modules\.bin\tfx.cmd extension create --root C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\package --output-path C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\package --manifests C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\package\vss-extension.json
Error: spawnSync C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\node_modules\.bin\tfx.cmd EINVAL
    at Object.spawnSync (node:internal/child_process:1124:20)
    at spawnSync (node:child_process:876:24)
    at Object.execFileSync (node:child_process:919:15)
    at packagePlugin (C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\build-scripts\packageExtension.ts:145:9)
    at Object.<anonymous> (C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\build-scripts\packageExtension.ts:156:1)
    at Module._compile (node:internal/modules/cjs/loader:1369:14)
    at Module.m._compile (C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\node_modules\ts-node\src\index.ts:858:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Object.require.extensions.<computed> [as .ts] (C:\Users\rbbarad\Desktop\azdo\public-repo\aws-toolkit-azure-devops\node_modules\ts-node\src\index.ts:861:12)
    at Module.load (node:internal/modules/cjs/loader:1206:32)

Solution

This PR fixes the issue by using a shell to run child_process execFileSync. This solution approach was suggested here: https://github.com/nodejs/node/issues/52554#issuecomment-2060026269

Related Issue(s), If Filed

Testing

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.