serverless-plugin-git-variables icon indicating copy to clipboard operation
serverless-plugin-git-variables copied to clipboard

Not works for Windows

Open cenyG opened this issue 2 years ago • 1 comments

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)

cenyG avatar Oct 08 '21 18:10 cenyG

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.

f00f avatar May 06 '22 07:05 f00f