Closed tjdcs closed 2 years ago
@tjdcs Thanks for reporting this. I think that VS Code does not support variable replacement in tasks.json files out of the box and it would have to be implemented at the extension level. This would then be a new feature.
So that I just understand the requirement better, may I ask what are you trying to achieve here? If I understand correctly, this is perhaps an attempt to work around some current limitations of the extensions, especially when it comes to MacOS. Since Austin requires sudo
on this platform, the "Profile with Austin" command doesn't work, so a potential solution is a rule in tasks.json, but currently that requires specifying an actual file path. You are then attempting to fix the first limitation with a placeholder for the file in tasks.json. Is this correct?
I can see two possible (non-mutually-exclusive) solutions here:
sudo
to the command. This would make the "Profile with Austin" command work on MacOS.Would either of these solve your issue?
tasks.json does allow for variable substitution and this can be tested. But the first proposal, which appends sudo
to the command if MacOS is detected is the most preferable. When do you think this fix will be released / published? Or is there a way to install a preview version (easily)
{
"version": "2.0.0",
"tasks": [
{
"label": "Test Variable Subs",
"type": "shell",
"command": "echo",
"args": [
"${workspaceFolder}",
"${file}"
],
"problemMatcher": []
}
]
}
Ah interesting! It should've worked then. Perhaps the substitutions need to be "triggered" with some API? Your experiments seem to suggest that the extension is getting the raw values.
I expect a new release to be available within a couple of days. I hope that works for you.
@tjdcs Release 0.11.0 is out with the fix for MacOS.
Thanks. Installed. Does not resolve the issue. args
needs to be updated when switching the command from austin
to sudo
Alternatively, set the command parameter to sudo austin
@tjdcs may I check with you what error you're getting. The fix seems to work. I have created a simple script
import time
def foo():
time.sleep(3)
foo()
which I run with shift + F5, and get
* Executing task: austin: profile /private/tmp/test.py
Starting Profiler in undefined.
Running 'sudo' with args 'austin -i 100 --pipe /Users/gabriele.tornetta/.pyenv/versions/3.9.13/bin/python /private/tmp/test.py'.
Profiling complete.
Sorry it was another configuration error in my environment. Just checked again. This is resolved! Thank you for the enhancement / fix!!
Not sure if this is a vs-code issue or an plugin issue, but my Austin task fails in vscode when I try to insert variables like
${workspaceFolder}
or${file}
in args.extension version: v0.10.8 os: macOS 12.6 (M1 Pro) vscode verson: 1.72.2 (Universal)
I have completed the necessary steps to invoke sudo instead of austin directly.
tasks.json
output: