Package hudson.remoting

Examples of hudson.remoting.StandardOutputStream


        public Boolean call() throws Exception {
            if (File.pathSeparatorChar==';')    return false;   // Windows
           
            OutputStream o = Channel.current().getUnderlyingOutput();
            if (o instanceof StandardOutputStream) {
                StandardOutputStream stdout = (StandardOutputStream)o;

                // duplicate the OS file descriptor and create FileOutputStream around it
                int out = GNUCLibrary.LIBC.dup(1);
                if (out<0)      throw new IOException("Failed to dup(1)");
                Constructor<FileDescriptor> c = FileDescriptor.class.getDeclaredConstructor(int.class);
                c.setAccessible(true);
                FileOutputStream fos = new FileOutputStream(c.newInstance(out));

                // swap it into channel so that it'll use the new file descriptor
                stdout.swap(fos);

                // close fd=1 (stdout) and duplicate fd=2 (stderr) into fd=1 (stdout)
                GNUCLibrary.LIBC.close(1);
                GNUCLibrary.LIBC.dup2(2,1);
                return true;
View Full Code Here

TOP

Related Classes of hudson.remoting.StandardOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.