Giter VIP home page Giter VIP logo

shell-fork's Introduction

1. What is this?

fork is a "remote shell". It allows the user to remotely start a shell, manage jobs, and give input and take output from those jobs. This means that all jobs share fork as their parent and inherit its permissions which is great for Android applications that want to ask for SuperUser only once. All remote interactions with fork are done through fork's standard input and output. 

1a. Job control

All job control happens over standard I/O. Communication between a fork client and fork is done using an ASCII protocol: COMMAND:TAG:EXTRA: 

COMMAND: One of START, STOP, INPUT, KILL. START and STOP start and stop processes, respectively. INPUT gives input to a process. KILL kills fork itself.
TAG: Identifies the process to be acted upon by the COMMAND. The TAG must be unique among currently running processes. TAGs can be reused once the associated process has finished. 
EXTRA: Only used by START and INPUT commands. For START commands, the EXTRA gives the command line to be executed to start a job. For INPUT commands, the EXTRA gives the actual input to be sent to the process' standard input.

1b. Job output

All job output is doubly tagged by the output type and the process' tag. 

The output type is one of OUTPUT, DEBUG, and ERROR. Output tagged by DEBUG and ERROR is for debugging and error reporting, respectively. The Java API discards these messages as soon as they are received.

Output tagged by OUTPUT is actual job output. After the OUTPUT tag, the job's tag is prepended to output and separated from the actual output with a ":". E.g., 
OUTPUT:GREP: asdfasdf
OUTPUT:GREP: asdfasdf
OUTPUT:PS: dddddddddd

2. API

The user can interact with fork directly over standard I/O. However, there is an included Java API that hides most of the fork protocol from the user. See the associated JavaDoc for information on how to use that API.

3. Building

Building fork itself is done with Make:
make

This puts the fork binary in the source code's root directory. 

Building the Java API is done with Ant:
ant jar

This puts Shell.jar in the source code's root directory. There are associated unit tests that can be build and run with Ant too:
ant junit 

This builds the unit tests and executes them. Unit tests will take about 30 seconds to run. During that time, expect no output. All unit test output will be placed in a file in the source code's root directory (its filename is generated dynamically but will include the TEST- prefix). 

shell-fork's People

Contributors

hawkinswnaf avatar cmdln avatar

Stargazers

Benjamin Chodoroff avatar

Watchers

Benjamin Chodoroff avatar Griffin Boyce avatar Andrew Reynolds avatar James Cloos avatar georgia bullen avatar Ben West avatar  avatar Dan Staples avatar Nat Meysenburg avatar  avatar  avatar Open Technology Institute avatar  avatar Andy Gunn avatar

Forkers

sohowaboutit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.