# Make travis wait on multi line script?

**URL:** <https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924>\
**Category:** Deployment\
**Tags:** build-env\
**Created:** [August 2, 2021, 4:25pm UTC](https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924 "2021-08-02T16:25:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [August 2, 2021, 4:25pm UTC](https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924/1 "2021-08-02T16:25:05Z")

</div>

I modifying a travis.yml where command runs for long time, more than 10 minutes. The special in this script is that, it is a maven command where the ouput is redirected to a file, and the whole command runs more than 35.

I’ve implemented Travis [doc](https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received) suggest to use `travis_wait` , but I haven’t found any example or something how to use it with multiline scripts.

is there anyway my team can do this?

There are two reasons we want this:

- not dealing with maven’s very long output
- avoid hitting Travis 4MB ouput limit

My script looks like this and the `mvn clean install` part should be waited.

```auto
script:
  - |
    if [[-z "$TRAVIS_TAG"]]; then
      mvn clean install > output.txt
    fi

```

What I tried so far are below, without positive results. I have to mention that I’m pretty new in working with yaml files.

```auto
script:
  - |
    travis_wait 40
    if [[-z "$TRAVIS_TAG"]]; then
      mvn clean install > output.txt
    fi

```

And

```auto
script:
  - |
    if [[-z "$TRAVIS_TAG"]]; then
      travis_wait 40 mvn clean install > output.txt
    fi

```

ive seen similar help tickets but no answer, thank you! @montana any advice? sorry to tag you, you always seem to know the best 😜

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [August 2, 2021, 4:28pm UTC](https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924/2 "2021-08-02T16:28:01Z")

</div>

Hey @SolarUltima,

In this scenario, using `travis_wait` will not do the specific job you want via the pipe is `output.txt` to a file. Travis will still see no output from the command.

Assuming the command itself produces enough output (which it should) and if not you can use `verbose`, the easy fix is:

```auto
mvn clean install | tee output.txt

```

This writes to `output.txt` _and_ outputs to `stdout` so that Travis recognizes the call, and picks up on it.

---

<div class="post-metadata">

**Author:** ![SolarUltima](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/solarultima/32/4019_2.png) [@SolarUltima](https://travis-ci.community/u/SolarUltima)\
**Post date:** [August 3, 2021, 3:28pm UTC](https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924/3 "2021-08-03T15:28:59Z")

</div>

as usual @montana, you got it on the head! 🙂

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [August 4, 2021, 12:15am UTC](https://travis-ci.community/t/make-travis-wait-on-multi-line-script/11924/4 "2021-08-04T00:15:57Z")

</div>

Cool, I’m glad I could solve your issue, remember in short with Java 9 if you declare both the test-scoped dependency and the Java 9 modules the test doesn’t compile anymore, which in this case would be:

```bash
mvn clean install output

```
