Search code examples
githubtravis-ci

How do I execute commands after connecting to telnet in travis-ci?


I want to enter a telnet session to memcached server. Then I want to check stats and quit. Here is my .travis.yml file:

language: c
compiler: gcc

before_install:
  - sudo apt-get install libmemcached-dev
  - sudo apt-get install memcached
  - sudo apt-get install libevent-dev
script:
  - cd TEST
  - memcached -d -u travis -m 128 -p 11211 127.0.0.1
  - chmod +x run_script
  - telnet localhost 11211
after_success:
  - stats
  - quit

However the "stats" and "quit" commands are never executed. No matter what I do.

Terminal output


Solution

  • The telnet session does not end, so the script step never finished, and the after_success does not happen.

    The telnet commands need to happen inside of the telnet session. You can use need something like the following "heredoc", to put either in the script or after_success phase:

      - telnet localhost 11211 <<-EOF
          stats
          quit
        EOF