microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
184 stars 55 forks source link

Preconfigure arguments doesn't work #531

Closed 156898293 closed 6 months ago

156898293 commented 7 months ago

when lunching preconfigure script via makfile tools the "preConfigureArgs": [" arg2 "] option seems to be ignored.

makefile_precfg.zip

156898293 commented 7 months ago

I forget to write how to reproduce: 1) open the workspace (proj\other\app.code-workspace) 2) preconfigure script should kick in (the output is there, but I ignore that --> too many text) 3) go to output->makefile tools; clear the window 4) run makefile -> preconfigure 5) in the output window should be something lie this:

Pre-configuring... Script: "**/kbuild_env.sh" argc 0 The pre-configure succeeded. Sending telemetry: eventName = preConfigure properties: exitCode = "0",triggeredBy = "command pallette (preConfigure)" measures: preConfigureElapsedTime = "0.025"

The main problem is the argc 0 it should be argc 1

gcampbell-msft commented 7 months ago

I believe #530 will fix the issue. We were incorrectly not putting space between the first argument and the command file. Feel free to pull down the code for that PR and try it, or wait until the pre-release channel has the fix. Thanks!

156898293 commented 7 months ago

Ok. I'll wait for next version available in the pre-release channel and report back.

156898293 commented 7 months ago

Just out of curiosity. you mentioned adding a space should solve the problem... is this the change you had in mind? "preConfigureArgs": [ "arg1" ], => "preConfigureArgs": [ " arg1" ], If so it doesn't help for my v0.8.16. I still get no args into my script.

gcampbell-msft commented 7 months ago

@156898293 Ah, thank you for the follow-up, the suggestion I made definitely fixes a bug, but it might not be the bug you were hitting. I'll pull down your zip file and test right now. Thanks!

gcampbell-msft commented 7 months ago

@156898293 Could you post a screenshot of your issue? Also, what OS are you running? Is this on Windows? Linux? Thanks.

156898293 commented 7 months ago

The minimal project and description is above. I just pass arguments to my pre-cofigure scripts and in the script I print number of arguments as "argc #" I run vscode on windows, but use ssh host to virtual-ubuntu. If you want I can give you access to my PC via teams meeting for debug purpose.

gcampbell-msft commented 7 months ago

@156898293 OH, I think I found the issue, it was a silly bug on my part (assuming I'm correct).

Could you install this vsix and test for me? You'll need to download it, then rename the download to makefile-tools.vsix. You can then install that vsix directly by doing the following:

image

makefile-tools.zip

156898293 commented 7 months ago

working on it

156898293 commented 7 months ago

It definitelly behavies differently. However it is still not working...

err: /tmp/wrapConfigureScript.sh: line 1: /home/xxxx/proj/preconfig.sh arg2 : No such file or directory

Full log

Pre-configuring... Script: "/home/xxxx/proj/preconfig.sh" /tmp/wrapConfigureScript.sh: line 1: /home/xxxx/proj/preconfig.sh arg2 : No such file or directory The pre-configure script returned success code but somewhere during the preconfigure process there were errors reported. Double check the preconfigure output in the Makefile Tools channel. Sending telemetry: eventName = preConfigure properties: exitCode = "-5",triggeredBy = "command pallette (preConfigure)" measures: preConfigureElapsedTime = "0.014"

gcampbell-msft commented 7 months ago

@156898293 I appreciate you helping me test this, as I don't currently have a readily available linux machine so it would take more time for me to test. I have one more thing that would be helpful to test: makefile-tools.zip

Follow the same steps as before.

156898293 commented 7 months ago

It looks the same. I'm gonna remove the extension and make sure I installed the correct one.

Pre-configuring... Script: "/home/xxxx/proj/preconfig.sh" /tmp/wrapConfigureScript.sh: line 1: "/home/xxxx/proj/preconfig.sh" arg2 : No such file or directory The pre-configure script returned success code but somewhere during the preconfigure process there were errors reported. Double check the preconfigure output in the Makefile Tools channel. Sending telemetry: eventName = preConfigure properties: exitCode = "-5",triggeredBy = "command pallette (preConfigure)" measures: preConfigureElapsedTime = "0.

156898293 commented 7 months ago

Ok I made sure I installed the correct .vsix and the output is the same as above... image

156898293 commented 7 months ago

I just tried to run it natively on Linux (no SSH) and got the same problem. Then I tried to run it natively on Win (no SSH) and it worked (had to switch from .sh to .bat)

gcampbell-msft commented 7 months ago

@156898293 Again, thank you for testing so quickly. I have what should definitely be the fix.

Originally the issue was that we weren't handling the script arguments on linux. Then the issue was that I was improperly quoting the items of the script such that it was treating the args as part of the filepath, now, it should be fixed.

makefile-tools.zip

156898293 commented 7 months ago

OK the last .vsix works now! Great job. I tested both natively and via ssh host.

P.S. I'll leave the ticket opened for you to close. P.P.S. THANKS for the work on Make-File-Tools it helps a lot for me and my team.

github-actions[bot] commented 6 months ago

:tada: This issue has now been fixed and is now available in the latest release! :tada: