emeraldwalk / vscode-runonsave

Visual Studio Code extension to run commands whenever a file is saved.
Apache License 2.0
182 stars 57 forks source link

Comand fail: /bin/sh: 1: [[: not found #26

Closed Alexbeis closed 5 years ago

Alexbeis commented 5 years ago

Hi, I'm having an issue with grunt file, that is executed with the following instruction:

"emeraldwalk.runonsave": { "autoClearConsole": true, "commands": [ { "match": ".*", "isAsync": true, "cmd": "echo 'I run for all files.'" }, { "match": "\\.js$", "cmd": "echo 'I am a .js file ${file}.'" }, { "match": "\\.(js|css|scss)$", "cmd": "[[ ${file} = *'/js/'* || ${file} = *'/scss/'*|| ${file} = *'/static/'*]] && cd ${workspaceRoot} && grunt build" } ] }

I'm having this output:

I run for all files. I am a .js file /home/aalbas/Documentos/sfcc_usa_dev08/xxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js. ** cmd start: [[ /home/aalbas/Documentos/sfcc_usa_dev08/xxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js = '/js/' || /home/aalbas/Documentos/sfcc_usa_dev08/xxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js = '/scss/'|| /home/aalbas/Documentos/sfcc_usa_dev08/xxxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js = '/static/'*]] && cd / && grunt build /bin/sh: 1: [[: not found /bin/sh: 1: /home/aalbas/Documentos/sfcc_usa_dev08/xxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js: Permission denied /bin/sh: 1: /home/aalbas/Documentos/sfcc_usa_dev08/xxxxx/source/app_storefront_xxxx/cartridge/js/components/newsletterpopup.js: Permission denied Run on Save done. First two commands, working well, third wrong.

Yes, Permission denied. I give chmod 777 to that file, give me a sintax error on that file. Something that's wrong because this file is comming from repo and working on production.

If I Execute grunt build on the terminal, and it is working perfectly. Not problems with permission.

I'm on ubuntu 18.04. Visual Studio code: v1.32.3 runonsave: 0.0.18 What could be the cause? Thanks

Alexbeis commented 5 years ago

Sorry for the inconvenience, was a missing config on visual studio.