serverless-plugin-git-variables
serverless-plugin-git-variables copied to clipboard
Not works for Windows
Hi, I just had some struggling around your pluging, it's still not working for my environment actualy for no reason. But I made some workaround and replace your _exec
function:
async function _exec(cmd, options = {
timeout: 1000
}) {
return new Promise((resolve, reject) => {
_child_process.default.exec(cmd, options, (err, stdout) => {
if (err) {
reject(err);
} else {
resolve(stdout.trim());
}
});
});
}
with this one:
async function _exec(cmd, options = {
timeout: 1000
}) {
return _child_process.default.execSync(cmd, { ...options, encoding: 'utf-8' }).trimEnd();
}
and now it's works for me.
I could create MR but I think it's a bit dirty. Just In case you would like to investigate.
My environment:
- Windows 10
- gitbash
- node(v14.16.1)
I work on Win 10 and run serverless from PowerShell. Don't know the node version I'm using (other pc), but should be 16 or 14. The released package works with no problems.