openmicroscopy/openmicroscopy — pull request #2742 by sbesson (2014-07-03 11:30:36+00:00)
Title: Add strict=True when invoking each line in bin/omero load (rebased onto develop)

This is the same as gh-2699 but rebased onto develop.

----

Fixes https://trac.openmicroscopy.org.uk/ome/ticket/12417

Because bin/omero load does not require a valid connection, the interactive connection logic was potentially causing interferences. For instance, if an interactive server askinput was escaped with Ctrl+C, the self.ctx.invoke() call would silently fail and move to the next line of the file.
This commit fixes this issue by setting strict=True, effectively aborting the full command if such an interruption is caused.

To test this PR:
- optionally, try to reproduce the failing scenario in the ticket without this PR merged
- check that the `bin/omero load` command without option is aborted when hitting Ctrl+C in the interactive login:

```
$ rm -rf ~/omero/sessions/ # force new connection
$ bin/omero logout && bin/omero load ../omego/create_users
Server: [localhost]
Username: [sebastien]^CCancelled
$
```
- check that the `keep-going` option allow the script to keep processing when hitting Ctrl+C in the interactive login prompt but displays a warning about the skipped line

```
$ rm -rf ~/omero/sessions/ # force new connection
$ bin/omero logout && bin/omero load --keep-going ../omego/create_users
Server: [localhost]
Username: [sebastien]^CCancelled
...
```