lib/launch_agent/cli.rb in launch-agent-0.7.0 vs lib/launch_agent/cli.rb in launch-agent-0.8.0
- old
+ new
@@ -11,15 +11,17 @@
end
def agent
raise 'full command must be supplied' if @argv.empty?
- daemon = @opts['--daemon']
- interval = @opts['--interval']
- env = (@opts['--env'] || '').split(',')
- wdir = @opts['--wdir']
- agent = nil
+ daemon = @opts['--daemon']
+ interval = @opts['--interval']
+ env = (@opts['--env'] || '').split(',')
+ wdir = @opts['--wdir']
+ stdout_path = @opts['--stdout']
+ stderr_path = @opts['--stderr']
+ agent = nil
if daemon
agent = LaunchAgent::Daemon.new(*@argv)
elsif interval
agent = LaunchAgent::Periodic.new(interval.to_i, *@argv)
@@ -33,9 +35,17 @@
memo
end
if wdir
agent['WorkingDirectory'] = File.expand_path(wdir)
+ end
+
+ if stdout_path
+ agent['StandardOutPath'] = File.expand_path(stdout_path)
+ end
+
+ if stderr_path
+ agent['StandardErrorPath'] = File.expand_path(stderr_path)
end
agent
end
end