Terminate Travis CI manually

Hi folks,
I have been trying to terminate/exit Travis CI build manually using a script which (itself) does not throw any exception but instead print an error log when the syntax (ttl) is not valid. See below one validation exception as an example.

gezim@gezim-Latitude-E5550:~/workspace/SDA/sda.tech$ ttl rdf-data/sda.tech.ttl 
{ [Error: Expected entity but got literal on line 24277.]
  context: 
   { token: { line: 24277, type: 'literal', value: '"en-US"', prefix: '' },
     line: 24277,
     previousToken: 
      { line: 24277,
        type: 'prefixed',
        value: 'language',
        prefix: 'dct' } } }
Validator finished with 0 warnings and 1 errors.

The TurtleValidator.sh script contains this :

#!/bin/bash
set -e
uit=$(ttl "$1")
if [[ $uit == *[Error:* ]]; then
   >&2 echo "Fail"; exit 1;
fi

and it has been fired on Travis using :

before_install:
  - npm install -g turtle-validator
script:
  - bash TurtleValidator.sh rdf-data/sda.tech.ttl

Please, have a look on .travis.yml file for more details.

Any help would be greatly appreciated.

Best regards,

There are a couple of problems with the way you are testing the command output from ttl.

  1. First, verify that the command’s output is going to STDOUT. The $() only gets STDOUT, so if ttl is sending the output ({ [Error…] }) to STDERR, your uit=$(ttl "$1") will not get it.
  2. Even if ttl is sending the output to STDOUT, matching it with [[ $uit == *[Error:* ]] is brittle at best. ttl is returning a structured data, so you should treat it as such. (Say, with jq, since it looks like JSON to me.)
1 Like

Hi Hiro,

many thanks for your valuable feedback. I will have a look on it and come back when it is working properly.

Best regards,