110 std_fds[1] = -1;
111 else if (redirects[1] == Redirect.INHERIT)
112 std_fds[1] = 1;
113 else {
114 f1 = new FileOutputStream(redirects[1].file(),
115 redirects[1].append());
116 std_fds[1] = fdAccess.get(f1.getFD());
117 }
118
119 if (redirects[2] == Redirect.PIPE)
120 std_fds[2] = -1;
121 else if (redirects[2] == Redirect.INHERIT)
122 std_fds[2] = 2;
123 else {
124 f2 = new FileOutputStream(redirects[2].file(),
125 redirects[2].append());
126 std_fds[2] = fdAccess.get(f2.getFD());
127 }
128 }
129
130 return new UNIXProcess
131 (toCString(cmdarray[0]),
132 argBlock, args.length,
133 envBlock, envc[0],
134 toCString(dir),
135 std_fds,
136 redirectErrorStream);
137 } finally {
138 // In theory, close() can throw IOException
139 // (although it is rather unlikely to happen here)
140 try { if (f0 != null) f0.close(); }
141 finally {
142 try { if (f1 != null) f1.close(); }
143 finally { if (f2 != null) f2.close(); }
144 }
145 }
146 }
147 }
|
110 std_fds[1] = -1;
111 else if (redirects[1] == Redirect.INHERIT)
112 std_fds[1] = 1;
113 else {
114 f1 = new FileOutputStream(redirects[1].file(),
115 redirects[1].append());
116 std_fds[1] = fdAccess.get(f1.getFD());
117 }
118
119 if (redirects[2] == Redirect.PIPE)
120 std_fds[2] = -1;
121 else if (redirects[2] == Redirect.INHERIT)
122 std_fds[2] = 2;
123 else {
124 f2 = new FileOutputStream(redirects[2].file(),
125 redirects[2].append());
126 std_fds[2] = fdAccess.get(f2.getFD());
127 }
128 }
129
130 return UNIXProcess.newInstance
131 (toCString(cmdarray[0]),
132 argBlock, args.length,
133 envBlock, envc[0],
134 toCString(dir),
135 std_fds,
136 redirectErrorStream);
137 } finally {
138 // In theory, close() can throw IOException
139 // (although it is rather unlikely to happen here)
140 try { if (f0 != null) f0.close(); }
141 finally {
142 try { if (f1 != null) f1.close(); }
143 finally { if (f2 != null) f2.close(); }
144 }
145 }
146 }
147 }
|