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

stdout #4

Closed
vim-zz opened this issue Mar 18, 2019 · 3 comments
Closed

stdout #4

vim-zz opened this issue Mar 18, 2019 · 3 comments

Comments

@vim-zz
Copy link

vim-zz commented Mar 18, 2019

When running with cargo instruments I can't see any output on the screen, is there a way to enable stdout?

@cmyr
Copy link
Owner

cmyr commented Mar 18, 2019

As far as I can tell, the instruments cli that we call swallows stdout from the child process, and there's no documented way to change this behaviour. The easiest workaround I can think of is to redirect stdout to a file for profiling; you could use a custom replacement of println! to make this easier. 😢

@vim-zz
Copy link
Author

vim-zz commented Apr 3, 2019

understood

@vim-zz vim-zz closed this as completed Apr 3, 2019
@samdenty
Copy link

samdenty commented Dec 25, 2020

It's possible to capture the stdout from any PID with:

capture() {
  sudo dtrace -p "$1" -qn '
        syscall::write*:entry
        /pid == $target && arg0 == 1/ {
            printf("%s", copyinstr(arg1, arg2));
        }
    '
}

# capture 1234

If I find the PID for target/debug can confirm it works

@samdenty samdenty mentioned this issue Dec 25, 2020
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

Successfully merging a pull request may close this issue.

3 participants