Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
583 stars 110 forks source link

fix: fix unknown deployment error in Linux #778

Closed cjk7989 closed 7 months ago

cjk7989 commented 7 months ago

To fix https://github.com/Azure/static-web-apps-cli/issues/776. The root cause is that in version 1.1.5, we wanted to run StaticSiteClient in app_root_path/staticsites-cli, corresponding to the following code:

const child = spawn(binary, [], {
  env: {
    ...swaCLIEnv(cliEnv, deployClientEnv),
  },
  cwd: clientWorkingDir,
});

The binary is the absolute path of StaticSiteClient, while clientWorkingDir is an absolute path of staticsites-cli. This will work as expected in Windows, as: Under clientWorkingDir, run "binary_path/StaticSiteClient.exe" in cmd.

But in Linux, if we assign the augment "cwd", the bash will resolve binary as a relative path, as: Under clientWorkingDir, run "./binary_path/StaticSiteClient" in bash.

Which will be broken with an unknown error.

So we remove the feature to assign clientWorkingDir in this PR.