Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a node.js script uses
node-sp-auth
and uses on-demand authentication theelectron
dependency might not be installed globally, but may instead simply be in the project local dependencies or even as adevDependency
. This means the electron package might easily be located in a path that contains spaces. (This would also be the case if the directorynpm
installs global packages to contains spaces, which is common on Windows systems where the user name contains spaces).On Windows the current code uses
childProcess.executeFileSync
with theshell: true
option. If electron is located in a path with spaces launching the electron process fails (since the path is not quoted).To fix this, this PR uses
childProcess.spawnSync
instead. This function will automatically quote arguments as appropriate for the current OS. This will also address the possibility of having themain.js
file in a path with spaces or spaces in the SharePoint Site URL.Additionally I have run into situations where electron does not work on my machine, after debugging I found the electron error message
After some googling this seems to be related to electron/electron#32074. So because of this I added an instruction in
main.js
to add the--no-sandbox
flag to the electron app and this fixes the issue.When submitting a pull request, make sure you do the following:
dev
branch on the main repo, not themaster
branchCloses #000
Not applicable