This commit is contained in:
mwiegand 2021-11-17 19:21:05 +01:00
parent 81559667b1
commit f388715edb
2 changed files with 14 additions and 12 deletions

View file

@ -5,23 +5,22 @@ puts strategies_dir
post "/:strategy" do |env| post "/:strategy" do |env|
strategy = env.params.url["strategy"] strategy = env.params.url["strategy"]
puts strategy
output = IO::Memory.new
params = env.params.query.to_h.to_json params = env.params.query.to_h.to_json
puts params
hook = env.params.json.to_json hook = env.params.json.to_json
puts strategy
puts params
puts hook puts hook
Process.run( Process.run(
"#{strategies_dir}/#{strategy}", "#{strategies_dir}/#{strategy}",
[ args: [hook, params],
hook, ) do |proc|
params, loop do
], puts proc.output.gets
output: output, break if proc.terminated?
error: output, end
) end
puts output.to_s
output.to_s
end end
Kemal.run Kemal.run

View file

@ -1,6 +1,9 @@
#!/usr/bin/env sh #!/usr/bin/env sh
echo "hello world!" echo "hello world!"
sleep 0.4
echo "ohno" &1>2 echo "ohno" &1>2
sleep 0.4
echo "hello world 2!" echo "hello world 2!"
sleep 0.4
echo "ohno 2" &1>2 echo "ohno 2" &1>2