Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:09:18+00:00 2026-06-06T19:09:18+00:00

I have some strange behavior redirecting stdout and stderr from s3cmd. For example: $

  • 0

I have some strange behavior redirecting stdout and stderr from s3cmd. For example:

$ touch test

$ s3cmd put test s3://non_existent_bucket
test -> s3://non_existent_bucket/test  [1 of 1]
 4 of 4   100% in    0s    88.17 B/s  done
ERROR: S3 error: 404 (NoSuchBucket): The specified bucket does not exist

This output is (if I’m not getting it wrong) part stdout and part stderr. That is shown as follows:

$ s3cmd put test s3://non_existent_bucket 2> log
test -> s3://non_existent_bucket/test  [1 of 1]
 4 of 4   100% in    0s   120.11 B/s  done

$ cat log
ERROR: S3 error: 404 (NoSuchBucket): The specified bucket does not exist

Effectively, stderr is redirected, but we want both stdout and stderr. Let’s try only stdout first:

$ s3cmd put test s3://non_existent_bucket > log
ERROR: S3 error: 404 (NoSuchBucket): The specified bucket does not exist

$ cat log

It is not written after the command so I understand stdout is in fact redirecting (or something), but it doesn’t get caught on the log file. I guess it somehow detects if it is connected to a tty or not, and only outputs this kind of data in the first case.

In the same way, if I try to redirect both streams, I get stderr but not the stdout output that I need:

$ s3cmd put test s3://non_existent_bucket >& log

$ cat log
ERROR: S3 error: 404 (NoSuchBucket): The specified bucket does not exist

In fact, what I need to do is call this from PHP and get the full output. I’ve only found ways to execute a command and retrieve stdout, so I’m doing as follows:

exec('s3cmd put test s3://non_existent_bucket 2>&1', $output);

And here, I don’t get any of the output from either streams. I guess I’m loosing stdout because s3cmd detects it’s not connected to a tty, but stderr I still don’t understand why it’s not caught.

Trying with popen() and exec() I get the same result.

I need the whole output, or stdout at least (although I guess the progress info will be somehow grabbled). Any idea?

Thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:09:20+00:00Added an answer on June 6, 2026 at 7:09 pm

    The man page for s3cmd details a --progress/--no-progress flag, with a description as follows:

    Display or don’t display progress meter. When running on TTY (e.g. console or xterm) the default is to display progress meter. If not on TTY (e.g. output is redirected somewhere or running from cron) the default is to not display progress meter.

    So it looks like s3cmd will do something like isatty(0) to determine whether to write the progress details to STDOUT or not, but if you explicitly specify --[no-]progress it will force one behaviour or the other.

    Try:

    exec('s3cmd --progress put test s3://non_existent_bucket 2>&1', $output);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some tasks in Ant have some pretty strange behavior. For example, javac silently ignores
I'm getting some strange behavior from a listview/the getChildAt method. I have a HashSet,
I have some new strange Eclipse behavior from yesterday. When I want to run
I have some strange behavior occurring in an ASP.NET application that I am trying
DataPager has some strange behavior. So to situate the problem, I have a DataPagerReapeater
I am experiencing some strange behavior with SQL Server CE 3.5 SP2. I have
I see some strange behavior which I do not understand. I have a helper
I am getting some strange behavior involving database queries that I have never seen
I have some strange behavior in my iphone app. I have an NSTimer which
I have come across some strange behavior in my iPhone Objective-C app. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.