Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return java exit code from python jgo #30

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

hanslovsky
Copy link
Member

Example success code:

$ jgo -Xmx1g org.scijava:parsington 1+3; echo $?
4
0

Example failure code:

$ jgo -Xmx1y org.scijava:parsington 1+3; echo $?
Invalid maximum heap size: -Xmx1y
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
ERROR 2018-12-16 13:16:50,926: Error in `/usr/bin/java -cp /home/hanslovskyp/.jgo/org/scijava/parsington/RELEASE/* -Xmx1y org.scijava.parse.Main 1+3': 1
usage: jgo [-v] [-u] [-U] [-m] [--ignore-jgorc] [--link-type type] [--additional-jars jar [jar ...]] [--additional-endpoints endpoint [endpoint ...]] [JVM_OPTIONS [JVM_OPTIONS ...]] <endpoint> [main-args]

Run Java main class from maven coordinates.

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         verbose mode flag
  -u, --update-cache    update/regenerate cached environment
  -U, --force-update    force update from remote Maven repositories (implies -u)
  -m, --manage-dependencies
                        use endpoints for dependency management (see "Details" below)
  -r REPOSITORY [REPOSITORY ...], --repository REPOSITORY [REPOSITORY ...]
                        Add additional maven repository (key=url format)
  -a ADDITIONAL_JARS [ADDITIONAL_JARS ...], --additional-jars ADDITIONAL_JARS [ADDITIONAL_JARS ...]
                        Add additional jars to classpath
  --additional-endpoints ADDITIONAL_ENDPOINTS [ADDITIONAL_ENDPOINTS ...]
                        Add additional endpoints
  --ignore-jgorc        Ignore ~/.jgorc
  --link-type {hard,soft,copy,auto}
                        How to link from local maven repository into jgo cache. Defaults to the `links' setting in ~/.jrunrc or 'auto' if not specified.

The endpoint should have one of the following formats:

- groupId:artifactId
- groupId:artifactId:version
- groupId:artifactId:mainClass
- groupId:artifactId:version:mainClass
- groupId:artifactId:version:classifier:mainClass

If version is omitted, then RELEASE is used.
If mainClass is omitted, it is auto-detected.
You can also write part of a class beginning with an @ sign,
and it will be auto-completed.
1

Follow-up to #29 for python jgo.

Potentially overlapping return codes for:

  • jgo parsing
  • maven bootstrapping and artifact resolving
  • jvm arguments
  • actual java program

For now I suggest we ignore these potential return code clashes.

Unverified

The committer email address is not verified.
Example success code:
```
$ jgo -Xmx1g org.scijava:parsington 1+3; echo $?
4
0
```

Example failure code:
```
$ jgo -Xmx1y org.scijava:parsington 1+3; echo $?
Invalid maximum heap size: -Xmx1y
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
ERROR 2018-12-16 13:16:50,926: Error in `/usr/bin/java -cp /home/hanslovskyp/.jgo/org/scijava/parsington/RELEASE/* -Xmx1y org.scijava.parse.Main 1+3': 1
usage: jgo [-v] [-u] [-U] [-m] [--ignore-jgorc] [--link-type type] [--additional-jars jar [jar ...]] [--additional-endpoints endpoint [endpoint ...]] [JVM_OPTIONS [JVM_OPTIONS ...]] <endpoint> [main-args]

Run Java main class from maven coordinates.

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         verbose mode flag
  -u, --update-cache    update/regenerate cached environment
  -U, --force-update    force update from remote Maven repositories (implies -u)
  -m, --manage-dependencies
                        use endpoints for dependency management (see "Details" below)
  -r REPOSITORY [REPOSITORY ...], --repository REPOSITORY [REPOSITORY ...]
                        Add additional maven repository (key=url format)
  -a ADDITIONAL_JARS [ADDITIONAL_JARS ...], --additional-jars ADDITIONAL_JARS [ADDITIONAL_JARS ...]
                        Add additional jars to classpath
  --additional-endpoints ADDITIONAL_ENDPOINTS [ADDITIONAL_ENDPOINTS ...]
                        Add additional endpoints
  --ignore-jgorc        Ignore ~/.jgorc
  --link-type {hard,soft,copy,auto}
                        How to link from local maven repository into jgo cache. Defaults to the `links' setting in ~/.jrunrc or 'auto' if not specified.

The endpoint should have one of the following formats:

- groupId:artifactId
- groupId:artifactId:version
- groupId:artifactId:mainClass
- groupId:artifactId:version:mainClass
- groupId:artifactId:version:classifier:mainClass

If version is omitted, then RELEASE is used.
If mainClass is omitted, it is auto-detected.
You can also write part of a class beginning with an @ sign,
and it will be auto-completed.
1
```
@ctrueden ctrueden merged commit c62b42d into master Dec 18, 2018
@ctrueden
Copy link
Member

Great! Thanks @hanslovsky.

@ctrueden ctrueden deleted the return-java-exit-code-py-jgo branch December 18, 2018 20:50
@hanslovsky hanslovsky mentioned this pull request Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants