diff --git a/data/export/launchd/launchd.plist.erb b/data/export/launchd/launchd.plist.erb
index 1731c4c..8694564 100644
--- a/data/export/launchd/launchd.plist.erb
+++ b/data/export/launchd/launchd.plist.erb
@@ -13,7 +13,9 @@
ProgramArguments
- <%= process.command %>
+ <%- command_args.each do |command| -%>
+ <%= command %>
+ <%- end -%>
KeepAlive
diff --git a/lib/foreman/export/launchd.rb b/lib/foreman/export/launchd.rb
index 4b9571f..ceee3a8 100644
--- a/lib/foreman/export/launchd.rb
+++ b/lib/foreman/export/launchd.rb
@@ -8,6 +8,7 @@ class Foreman::Export::Launchd < Foreman::Export::Base
engine.each_process do |name, process|
1.upto(engine.formation[name]) do |num|
port = engine.port_for(process, num)
+ command_args = process.command.split(" ")
write_template "launchd/launchd.plist.erb", "#{app}-#{name}-#{num}.plist", binding
end
end
diff --git a/spec/foreman/export/launchd_spec.rb b/spec/foreman/export/launchd_spec.rb
index 984b35c..3a22b5a 100644
--- a/spec/foreman/export/launchd_spec.rb
+++ b/spec/foreman/export/launchd_spec.rb
@@ -18,4 +18,14 @@ describe Foreman::Export::Launchd, :fakefs do
File.read("/tmp/init/app-bravo-1.plist").should == example_export_file("launchd/launchd-b.default")
end
+ context "with multiple command arguments" do
+ let(:procfile) { FileUtils.mkdir_p("/tmp/app"); write_procfile("/tmp/app/Procfile", "charlie") }
+
+ it "splits each command argument" do
+ launchd.export
+ File.read("/tmp/init/app-alpha-1.plist").should == example_export_file("launchd/launchd-c.default")
+ end
+
+ end
+
end
diff --git a/spec/resources/export/launchd/launchd-c.default b/spec/resources/export/launchd/launchd-c.default
new file mode 100644
index 0000000..8059a9d
--- /dev/null
+++ b/spec/resources/export/launchd/launchd-c.default
@@ -0,0 +1,28 @@
+
+
+
+
+ Label
+ app-alpha-1
+ EnvironmentVariables
+
+ PORT
+ 5000
+
+ ProgramArguments
+
+ ./alpha
+ charlie
+
+ KeepAlive
+
+ RunAtLoad
+
+ StandardErrorPath
+ /var/log/app/app-alpha-1.log
+ UserName
+ app
+ WorkingDirectory
+ /tmp/app
+
+