/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include <stdlib.h>

#include "verbose.h"
#include "utils.h"

unsigned utils_execute_command(const char *cmd)
{
    int result = system(cmd);

    if (result == 0) {
        verbose_log(0, LOG_WARNING, "%s: '%s' succeeded.",
                    __FUNCTION__, cmd);
        return 1;
    } else {
        if (result == -1) {
            verbose_log(0, LOG_WARNING,
                        "%s: Unable to invoke '%s'.", __FUNCTION__, cmd);
        } else if (result != 0) {
            verbose_log(0, LOG_WARNING,
                        "%s: '%s' failed.  Return code: %d.",
                        __FUNCTION__, cmd, result);
        }
        return 0;
    }
}

/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include <stdlib.h>

#include "verbose.h"
#include "utils.h"

unsigned utils_execute_command(const char *cmd)
{
    int result = system(cmd);

    if (result == 0) {
        verbose_log(7, LOG_WARNING, "%s: '%s' succeeded.",
                    __FUNCTION__, cmd);
        return 1;
    } else {
        if (result == -1) {
            verbose_log(0, LOG_WARNING,
                        "%s: Unable to invoke '%s'.", __FUNCTION__, cmd);
        } else if (result != 0) {
            verbose_log(0, LOG_WARNING,
                        "%s: '%s' failed.  Return code: %d.",
                        __FUNCTION__, cmd, result);
        }
        return 0;
    }
}

Reduce spew when using system().
ADHD: Reduce spew when using system().

Details

  Increase the verbosity which is required to output messages about
  the successful use of 'system()'.

  In short, we don't really care about success; if the command
  executed, it's not really necessary to see each command which is
  executed at verbosity 0.

  Failures are still reported at verbosity 0.

Testing

  Built ADHD on tegra2_aebl, x86-mario.
  Visual inspection.

BUG=chromium-os:19558
TEST=See above.

Change-Id: Ib1743385e7fc54cb29a098b7e0912ca55a292503
Signed-off-by: Taylor Hutt <39a9c928d8a3a00d7fd484a843cc4ccfc80af42c@chromium.org>
