View previous topic :: View next topic |
Author |
Message |
Shidouuu n00b
Joined: 28 Mar 2021 Posts: 16
|
Posted: Mon Apr 12, 2021 12:58 pm Post subject: strace outputs nothing when used in wgetpaste |
|
|
When using strace in wgetpaste, wgetpaste returns "Apparently nothing was received. Perhaps the connection failed."
Example: Code: | wgetpaste -c 'strace echo hello |
Am I doing something wrong or is this a bug?
Edit:
Think I figured it out. It's not a problem with wgetpaste, it's that strace's output is not considered output like cat's output for example. Rather, it's just text on the terminal (don't really know how else to explain it).
So if you were to do strace echo hello > strace_echo_hello.txt, the file would be empty. |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Mon Apr 12, 2021 6:38 pm Post subject: |
|
|
Wait....!
Try:
Code: | echo "Hi" >c1 2>c2
cat c1
cat c2
strace ls >c1 2>c2
cat c1
cat c2 |
Can you see the difference? The output of echo goes to STDOUT. The output of strace goes to STDERR. Use "2>&1" to redirect the output of strace to STDOUT. Or, even better, write the output of strace to a file (using option '-o') and wgetpaste the file. |
|
Back to top |
|
|
Shidouuu n00b
Joined: 28 Mar 2021 Posts: 16
|
Posted: Mon Apr 12, 2021 7:19 pm Post subject: |
|
|
Ohhhhhhhhhh |
|
Back to top |
|
|
username234 Guru
Joined: 09 May 2007 Posts: 332
|
Posted: Mon Apr 12, 2021 8:11 pm Post subject: |
|
|
stdout vs stderr does not make a difference here. wgetpaste captures both. Redirecting strace output to a file also do not solve (or work-around) the problem. _________________ Creating usernames when you're
in a creative slump is a bad idea
because if you are when you do
then you end up with uninspiring
alphanumeric cocktails like the
one directly above. |
|
Back to top |
|
|
Shidouuu n00b
Joined: 28 Mar 2021 Posts: 16
|
Posted: Mon Apr 12, 2021 8:29 pm Post subject: |
|
|
So in that case would it be a bug? |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Mon Apr 12, 2021 9:10 pm Post subject: |
|
|
username234 wrote: | stdout vs stderr does not make a difference here. wgetpaste captures both. Redirecting strace output to a file also do not solve (or work-around) the problem. |
Well,
Code: | strace echo hello 2>strace_echo_hello.txt |
works,
Code: | strace echo hello 2>&1 | wgetpaste |
works as well (although it mixes STDOUT and STDERR) and
Code: | wgetpaste -c 'strace echo hello' |
also works, see https://dpaste.com/BAXYLP5LZ
Anyway, I recommend:
Code: | strace -o /tmp/strace_output.txt echo hello
more /tmp/strace_output.txt # check the result
wgetpaste /tmp/strace_output.txt |
|
|
Back to top |
|
|
Shidouuu n00b
Joined: 28 Mar 2021 Posts: 16
|
Posted: Tue Apr 13, 2021 12:25 pm Post subject: |
|
|
I did a strace of Code: | wgetpaste -c 'strace echo hello' | using Code: | strace -o strace.txt wgetpaste -c 'strace echo hello' 2>&1 | wgetpaste | and it says "stdin" on the dpaste. Is that right? |
|
Back to top |
|
|
mike155 Advocate
Joined: 17 Sep 2010 Posts: 4438 Location: Frankfurt, Germany
|
Posted: Tue Apr 13, 2021 1:58 pm Post subject: |
|
|
Your command is too complicated. I wouldn't write something like that. Difficult to understand. Bad style!
But if I execute your command, I get this result: https://dpaste.com/7HXWKW8FF.
And that's what I would expect.
Which shell do you use? Bash? |
|
Back to top |
|
|
Shidouuu n00b
Joined: 28 Mar 2021 Posts: 16
|
Posted: Tue Apr 13, 2021 2:25 pm Post subject: |
|
|
Yeah |
|
Back to top |
|
|
|