kopia lustrzana https://github.com/gaul/s3proxy
added whether console is attached or not
rodzic
9c74851c43
commit
84ec8e22da
|
@ -16,10 +16,12 @@
|
|||
|
||||
package org.gaul.s3proxy;
|
||||
|
||||
import java.io.Console;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
@ -43,8 +45,11 @@ import org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext;
|
|||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.Option;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class Main {
|
||||
private static final Logger logger = LoggerFactory.getLogger(Main.class);
|
||||
private Main() {
|
||||
throw new AssertionError("intentionally not implemented");
|
||||
}
|
||||
|
@ -59,6 +64,11 @@ public final class Main {
|
|||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Console console = System.console();
|
||||
if (console == null) {
|
||||
System.setErr(createLoggerErrorPrintStream());
|
||||
}
|
||||
|
||||
Options options = new Options();
|
||||
CmdLineParser parser = new CmdLineParser(options);
|
||||
try {
|
||||
|
@ -229,6 +239,14 @@ public final class Main {
|
|||
}
|
||||
}
|
||||
|
||||
private static PrintStream createLoggerErrorPrintStream() {
|
||||
return new PrintStream(System.err) {
|
||||
public void print(final String string) {
|
||||
logger.error(string);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static BlobStore createBlobStore(Properties properties)
|
||||
throws IOException {
|
||||
String provider = properties.getProperty(Constants.PROPERTY_PROVIDER);
|
||||
|
|
Ładowanie…
Reference in New Issue