diff --git a/build-server-crystal.cr b/build-server-crystal.cr index 2162557..09b4774 100644 --- a/build-server-crystal.cr +++ b/build-server-crystal.cr @@ -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 diff --git a/test/strategy b/test/strategy index 809115b..5371456 100755 --- a/test/strategy +++ b/test/strategy @@ -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