Example usage for org.apache.hadoop.util Shell USER_NAME_COMMAND

List of usage examples for org.apache.hadoop.util Shell USER_NAME_COMMAND

Introduction

In this page you can find the example usage for org.apache.hadoop.util Shell USER_NAME_COMMAND.

Prototype

String USER_NAME_COMMAND

To view the source code for org.apache.hadoop.util Shell USER_NAME_COMMAND.

Click Source Link

Document

a Unix command to get the current user's name: .

Usage

From source file:org.apache.hama.bsp.BSPJobClient.java

License:Apache License

protected static String getUnixUserName() throws IOException {
    String[] result = executeShellCommand(new String[] { Shell.USER_NAME_COMMAND });
    if (result.length != 1) {
        throw new IOException(
                "Expect one token as the result of " + Shell.USER_NAME_COMMAND + ": " + toString(result));
    }/*w  w  w  . ja  va2 s .  co m*/
    String fixResult = fixCygwinName(result[0]);
    return fixResult;
}