README.md in shelltastic-0.4.0 vs README.md in shelltastic-0.5.0

- old
+ new

@@ -15,10 +15,12 @@ $ gem install shelltastic ## Usage +### Run + ```ruby ShellTastic::Command.run("date") ``` The above will return an Array of hash meta-data. @@ -28,11 +30,22 @@ ``` For example, the above command's return would look something like this: ```ruby -[{:output=>"Sun Feb 3 17:41:45 EST 2013", :pid=>17507, :error=>false, :start=>2013-02-03 17:41:45 -0500, :stop=>2013-02-03 17:41:45 -0500, :total_time=>0.004405272, :exitstatus=>0}] +[ + { + :output=>"Sun Feb 3 17:41:45 EST 2013", + :pid=>17507, + :command => "date", + :error=>false, + :start=>2013-02-03 17:41:45 -0500, + :stop=>2013-02-03 17:41:45 -0500, + :total_time=>0.004405272, + :exitstatus=>0 + } +] ``` You can also pass multiple commands separated by commas or pass an array. ```ruby @@ -42,10 +55,77 @@ ```ruby ShellTastic::Command.run(["date", "whoami"]) ``` ```ruby -[{:output=>"Sat Apr 6 15:26:05 EDT 2013", :pid=>92558, :error=>false, :start=>2013-04-06 15:26:05 -0400, :stop=>2013-04-06 15:26:05 -0400, :command=>"date", :total_time=>0.010004, :exitstatus=>0}, {:output=>"bradleydsmith", :pid=>92559, :error=>false, :start=>2013-04-06 15:26:05 -0400, :stop=>2013-04-06 15:26:05 -0400, :command=>"whoami", :total_time=>0.008262, :exitstatus=>0}] +[ + { + :output=>"Sat Apr 6 15:26:05 EDT 2013", + :pid=>92558, + :error=>false, + :start=>2013-04-06 15:26:05 -0400, + :stop=>2013-04-06 15:26:05 -0400, + :command=>"date", + :total_time=>0.010004, + :exitstatus=>0 + }, + + { + :output=>"bradleydsmith", + :pid=>92559, + :error=>false, + :start=>2013-04-06 15:26:05 -0400, + :stop=>2013-04-06 15:26:05 -0400, + :command=>"whoami", + :total_time=>0.008262, + :exitstatus=>0 + } +] +``` + +### Start +Start will run a command in the background and return the pid immediately. + +It takes the same command arguments as `#run` + +The parent process (you) will not wait for the child to finish or return any information. + +This is useful if you want to run a command, but dont care about the output or exit status. + +__BEWARE__ of long running commands that could fail. ShellTastic detaches itself from the child command. + + + +```ruby +ShellTastic::Command.start("sleep 10; date") +``` +or + +```ruby +ShellTastic::Command.start(["sleep 10", "date"]) +``` + +The above will return an Array of hash meta-data. + +```ruby +[{ :output, :pid, :error, :start, :stop, :total_time, :exitstatus, :command }] +``` + +For example, the above command's return would look something like this: + +```ruby +[ + { + :output=>nil, + :pid=>17507, + :error=>false, + :start=>2013-02-03 17:41:45 -0500, + :stop=>2013-02-03 17:41:45 -0500, + :command=>"sleep 10; date", + :total_time=>0.004405272, + :exitstatus=>nil + } +] ``` ## Contributing