MCPcopy Create free account
hub / github.com/apache/pig / fs

Method fs

src/org/apache/pig/scripting/Pig.java:57–72  ·  view source on GitHub ↗

Run a filesystem command. Any output from this command is written to stdout or stderr as appropriate. @param cmd Filesystem command to run along with its arguments as one string. @throws IOException

(String cmd)

Source from the content-addressed store, hash-verified

55 * @throws IOException
56 */
57 public static int fs(String cmd) throws IOException {
58 ScriptPigContext ctx = getScriptContext();
59 FsShell shell = new FsShell(ConfigurationUtil.toConfiguration(ctx
60 .getPigContext().getProperties()));
61 int code = -1;
62 if (cmd != null) {
63 String[] cmdTokens = cmd.split("\\s+");
64 if (!cmdTokens[0].startsWith("-")) cmdTokens[0] = "-" + cmdTokens[0];
65 try {
66 code = shell.run(cmdTokens);
67 } catch (Exception e) {
68 throw new IOException("Run filesystem command failed", e);
69 }
70 }
71 return code;
72 }
73
74 /**
75 * Run a sql command. Any output from this command is written to

Callers 2

fsMethod · 0.95
mainFunction · 0.45

Calls 6

getScriptContextMethod · 0.95
toConfigurationMethod · 0.95
getPigContextMethod · 0.95
splitMethod · 0.80
getPropertiesMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected