comparison src/com/google/ase/Exec.java @ 0:0ce5cc452d02

initial version
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 10:41:19 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0ce5cc452d02
1 /*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.google.ase;
18
19 import java.io.FileDescriptor;
20
21 /**
22 * Tools for executing commands.
23 */
24 public class Exec {
25 /**
26 * @param cmd
27 * The command to execute
28 * @param arg0
29 * The first argument to the command, may be null
30 * @param arg1
31 * the second argument to the command, may be null
32 * @return the file descriptor of the started process.
33 *
34 */
35 public static FileDescriptor createSubprocess(String cmd, String arg0, String arg1) {
36 return createSubprocess(cmd, arg0, arg1, null);
37 }
38
39 /**
40 * @param cmd
41 * The command to execute
42 * @param arg0
43 * The first argument to the command, may be null
44 * @param arg1
45 * the second argument to the command, may be null
46 * @param processId
47 * A one-element array to which the process ID of the started process will be written.
48 * @return the file descriptor of the started process.
49 *
50 */
51 public static native FileDescriptor createSubprocess(String cmd, String arg0, String arg1,
52 int[] processId);
53
54 public static native void setPtyWindowSize(FileDescriptor fd, int row, int col, int xpixel,
55 int ypixel);
56
57 /**
58 * Causes the calling thread to wait for the process associated with the receiver to finish
59 * executing.
60 *
61 * @return The exit value of the Process being waited on
62 *
63 */
64 public static native int waitFor(int processId);
65
66 static {
67 System.loadLibrary("com_google_ase_Exec");
68 }
69 }