Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the extension #124

Closed
nimski opened this issue Jul 10, 2022 · 4 comments
Closed

Using the extension #124

nimski opened this issue Jul 10, 2022 · 4 comments

Comments

@nimski
Copy link

nimski commented Jul 10, 2022

Description

Is there a way to run Austin with sudo on MacOS using the VS Code extension? I'm able to run Austin from the terminal directly, but when attempting to run it with sudo using the following script, I get the error message austin process exited with code 1.

{
"label": "pytest with austin",
"type": "austin",
"command": ["sudo"],
"args": [
"${workspaceRoot}/.venv/bin/python",
"-m",
"pytest",
"-k",
""TEST NAME""],
"problemMatcher": []
},

Expected behavior: I'd expect Austin to run the task with sudo (the only way to run it in MacOS) and pipe it to the flamegraph viz.

Actual behavior: Exits with austin process exited with code 1.

Reproduces how often: Every time.

Versions

Version 3.3.0. MacOS 12.3 (Monterey)

Thanks for your help!

@P403n1x87
Copy link
Owner

@nimski I think you might find this comment useful:

P403n1x87/austin-vscode#24 (comment)

The idea is to allow Austin to run with sudo without password by adding a rule to the sudoers file, and then actually launch the sudo command instead of Austin itself.

@nimski
Copy link
Author

nimski commented Jul 10, 2022

Thanks very much @P403n1x87 . Following that example Austin indeed can run without sudo and I'm able to successfully create a profile with -o xxx.austin and load it up in the flame graph viewer. However, I'm unable to use the "austin" task to pipe it directly through the VSCode extension. If I try I get the error message: austin process exited with code 33 whereas the same command works from the VSCode terminal.

@P403n1x87
Copy link
Owner

Ah that's weird 🤔 . I have just tried with the following in .vscode/tasks.js

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "austin",
			"label": "Test Austin tasks",
			"command": [
				"sudo"
			],
			"args": [
				"python3.9",
				"-c",
				"from time import sleep; sleep(2)",
			]
		},
	]
}

and I've got the following flame graph

Screenshot 2022-07-11 at 19 23 43

Could you maybe try with the absolute path to python? Error 33 normally indicates failure to fork the subprocess, so perhaps Austin is not being able to find the interpreter from VS Code for some reasons?

@nimski
Copy link
Author

nimski commented Jul 12, 2022

That was it! It's working well now. Thatnks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants