From b9df898902417866409e74d1e6098ca3dbe01f3d Mon Sep 17 00:00:00 2001 From: Ho-Sheng Hsiao Date: Fri, 30 Mar 2012 23:39:10 -0400 Subject: [CHEF-2994][DOC] Add stdin example to README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index e6cdc65..93baa67 100644 --- a/README.md +++ b/README.md @@ -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. -- cgit v1.2.1