Closed iljah closed 2 months ago
Above scripts might require this to work: https://github.com/visit-dav/visit/pull/19346
@iljah
It looks like I am able to return a specific code from the CLI, does the following work for you?
$ visit -nowin -cli
import sys sys.exit(0) $ echo $? 0 $ visit -nowin -cli sys.exit(100) $ echo $? 100
Not sure if exit() and sys.exit() are different things but neither works for me:
$ visit -nowin -cli
Running: cli3.4.1 -nowin
Running: viewer3.4.1 -nowin -noint -host 127.0.0.1 -port 5600
>>> exit(0)
$ echo $?
250
$ visit -nowin -cli
Running: cli3.4.1 -nowin
Running: viewer3.4.1 -nowin -noint -host 127.0.0.1 -port 5600
>>> from sys import exit; exit(0)
$ echo $?
250
Strange. I see the following:
$ visit -nowin -cli
Running: cli3.4.1 -nowin
Running: viewer3.4.1 -nowin -noint -host 127.0.0.1 -port 5601
>>> exit(0)
$ echo $?
0
$ visit -nowin -cli
Running: cli3.4.1 -nowin
Running: viewer3.4.1 -nowin -noint -host 127.0.0.1 -port 5601
>>> import sys
>>> sys.exit(0)
$ echo $?
0
Do any @visit-dav/visit-developers have access to a fedora 40 system to attempt to reproduce?
os._exit(0) seems to work:
$ visit -nowin -cli
Running: cli3.4.1 -nowin
Running: viewer3.4.1 -nowin -noint -host 127.0.0.1 -port 5600
>>> import os; os._exit(0)
$ echo $?
0
@iljah I am glad you found a working solution. I am not sure why the return codes don't propagate from the other calls on your system.
Can we close this ticket then?
Sure, thanks.
Describe the bug
When programs exit without error their return value is 0 on fedora/linux/posix/unix? systems.
When VisIt script consisting of only
#! /usr/bin/env -S visit -nowin -cli -s
exits its return value is 250, which breaks e.g. command chaining with&&
, etc. This script also exits with value 250:To Reproduce
With above script(s) (note
;
instead of&&
):Expected behavior
When no errors happen, visit should exit with return value 0 so that subsequent command line commands are also executed (note
&&
instead of;
):Desktop
Also tested with 3.4.1 from https://github.com/visit-dav/visit/releases/download/v3.4.1/visit3_4_1.linux-x86_64-fedora31.tar.gz