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|
strategy = env.params.url["strategy"]
puts strategy
output = IO::Memory.new
params = env.params.query.to_h.to_json
puts params
hook = env.params.json.to_json
puts strategy
puts params
puts hook
Process.run(
"#{strategies_dir}/#{strategy}",
[
hook,
params,
],
output: output,
error: output,
)
puts output.to_s
output.to_s
args: [hook, params],
) do |proc|
loop do
puts proc.output.gets
break if proc.terminated?
end
end
end
Kemal.run

View file

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