Perfectly working curl command fails when executed in a groovy script

后端 未结 4 746
不思量自难忘°
不思量自难忘° 2021-02-02 11:08

I have a post commit hook (a groovy script) in gitblit to invoke a REST endpoint. In this script I am executing a curl command. But it seems to fail. The curl command works fine

4条回答
  •  旧时难觅i
    2021-02-02 11:31

    To avoid ‘running-forever’ process (this happens on some Windows env when output exceeds 4096 bytes) add initial size to ByteArrayOutputStream

    def initialSize = 4096
    def out = new ByteArrayOutputStream(initialSize)
    def err = new ByteArrayOutputStream(initialSize)
    def proc = command.execute()
    proc.consumeProcessOutput(out, err)
    proc.waitFor()
    

提交回复
热议问题