diff options
author | Ho-Sheng Hsiao <hosheng.hsiao@gmail.com> | 2012-03-30 23:39:10 -0400 |
---|---|---|
committer | Ho-Sheng Hsiao <hosh@opscode.com> | 2012-05-10 14:51:43 -0400 |
commit | b9df898902417866409e74d1e6098ca3dbe01f3d (patch) | |
tree | ef1d0f41dda212d27a698e2d2bac4cf5967ccefe | |
parent | 65440f41e1b20251abbcf65896eb39fa9a157245 (diff) | |
download | mixlib-shellout-b9df898902417866409e74d1e6098ca3dbe01f3d.tar.gz |
[CHEF-2994][DOC] Add stdin example to README
-rw-r--r-- | README.md | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -28,6 +28,14 @@ Run a command as the `www` user with no extra ENV settings from `/tmp` cmd = Mixlib::ShellOut.new("apachectl", "start", :user => 'www', :env => nil, :cwd => '/tmp') cmd.run_command # etc. +## STDIN Example +Invoke crontab to edit user cron: + + # :input only supports simple strings + crontab_lines = [ "* * * * * /bin/true", "* * * * * touch /tmp/here" ] + crontab = Mixlib::ShellOut.new("crontab -l -u #{@new_resource.user}", :input => crontab_lines.join("\n")) + crontab.run_command + ## Platform Support Mixlib::ShellOut does a standard fork/exec on Unix, and uses the Win32 API on Windows. There is not currently support for JRuby. |