Questions tagged [exit-code]
An exit code is signaled by a program on termination to indicate if it completed successfully, or, if it did not, what sort of failure condition occurred.
1,078
questions
1
vote
1
answer
27
views
Why does adb return zero exit status in case of "failed to connect"?
Why does adb return zero exit status in case of "failed to connect"?
Demo:
$ adb connect 123.123.123.123:123
failed to connect to '123.123.123.123:123': Connection refused
$ echo $?
0
Is it ...
1
vote
0
answers
11
views
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) - How can I solve this issue with my code below?
What could be causing this issue?
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Here is my script:
import googlemaps
import webbrowser
from ortools.constraint_solver import ...
0
votes
0
answers
26
views
App compatibility issues in Xcode15 bitrise build
Currently, I am using Xcode 13.x, now I am upgrading it to Xcode 15. Local it is working fine but when I build it using Bitrise it is throwing me the error
"Building for 'iOS-simulator', but ...
-1
votes
0
answers
63
views
Get exit code of last command in a shell script
Using $? I'm trying to get the exit code of the last command I entered, but something seems to be interfering. I'm wondering if this is because the $? variable doesn't play nice with scripts or if ...
0
votes
0
answers
22
views
Process finished with exit code -1073740940 (0xC0000374). Python [duplicate]
I'm encountering an issue while trying to run my Python project on Windows 10. The process finishes with exit code -1073740940 (0xC0000374). I've attempted reinstalling dependencies, cloning the ...
1
vote
1
answer
45
views
Getting exit code from the application running in a container (kubernetes)
I am trying to get the exit from the application running in a kubernetes cluster. I can see the pod status as Error but I am interested in getting the exact exit code.
Docker File:
# getting base ...
1
vote
1
answer
64
views
What causes exist status 2 error? (GOLang)
Got this long error when running a simple Go program. Here's my main.go, which has all the functions in a single file (vscode was giving me errors otherwise, even though all files were using package ...
0
votes
1
answer
129
views
Why does my shell script register a successful exit when it fails?
I have a shell script that executes whisper on all files in a directory on a network device, and then stores the resulting transcript on the same volume. Sometimes something happens with the network (...
0
votes
0
answers
35
views
exit code bash commands env and pwd with an invalid option [duplicate]
These two errors are not treated in the same manner.
One has told me that env is not a builtin in bash.
Why the exit codes are different ?
pwd -y
bash: pwd: -y: invalid option
echo $?
2
env -y
env: ...
0
votes
0
answers
30
views
Why does ignoring SIGCHLD cause exit code -1?
This code expectedly outputs "0":
exec('date', $output, $resultCode);
echo $resultCode . PHP_EOL;
However, if I prepend this line:
pcntl_signal(SIGCHLD, SIG_IGN);
then the output is "-...
2
votes
1
answer
54
views
Fail bash script when command expansion fails
I'd like to be able to warn and fail if the following command expansion fails:
#!/usr/bin/env bash
set -Eeuo pipefail
echo "$(invalid_cmd)"
echo "$?"
Instead of failing, I get ...
-2
votes
2
answers
75
views
How to exit a bash script if the c++ compiler finds an error?
I am using a bash script that does the following:
makepp
./mainHeu
where makepp is used to run a c++ code that returns the executable ./mainHeu.
I would like to stop the bash script before ./mainHeu ...
1
vote
1
answer
103
views
Python process ends with exit code -11 when trying to play audio
I'm trying to write a program for a raspberry pi 3b in python that plays a random loaded .wav file when an on board button is pressed, but it gets to the point of attempting to play the sound then ...
1
vote
3
answers
68
views
Can I make bad [ syntax in a bash if statement cause the shell to exit with an error?
Consider the following bash code:
if [ "$a" = "foo"]
then
echo "TRUE"
fi
echo $?
we get:
bash: [: missing `]'
0
So basically, the test in the if fails due to a typo (...
0
votes
0
answers
14
views
Spring Batch - How to return exit code from an application that uses JobParameters? [duplicate]
I have a spring batch application, where some jobs are executed. It works normally, but at this moment, I need it to return error codes in the command prompt (shell) according to some conditions:
for ...
1
vote
1
answer
57
views
How to set / read shell variables in Jenkins
I'm teaching myself Jenkins and am trying to direct execution flow of a 'pipeline job via declarative syntax' based on result of Test Stage, which I try to implement via the pytest exit code into a ...
0
votes
0
answers
32
views
LSF (bsub) exit code inconsistent in airflow SSHOperator
TL;DR
bsub -K exit 1 || echo Result : $?
Results
Result : 1 in interactive shell
Result : 0 using Airflow SSHOperator
More details
When I run the following command in an interactive shell, I get ...
0
votes
0
answers
31
views
Why did the subProcess forked by the main process of Electron v20 exit immediately with code 134
I have an Electron application, recently upgraded to version 20, some windows users have encountered a problem, check the log because a child process cannot be created normally。
this is log describing:...
0
votes
0
answers
373
views
Airflow Bash command failed. The command returned a non zero exit code 2
While running an airflow DAG to execute a shell script using Bash Operator, getting error of AirflowException: Bash command failed, getting a non zero exit code 2.
I am using the same process to run ...
1
vote
1
answer
28
views
Can git diff report the exit code of an external diff program?
I know git diff can report a diff-like exit code, using the --exit-code option. However, I haven't found a way to make this play nicely with an external diff program. That is, I would like the ...
0
votes
1
answer
159
views
Catching the correct error code in Python and PowerShell
I am running a Python FastAPI app with 4 different APIs. In the first one, I have implemented an error handling which after some trouble is working somehow fine. So I copied it's structure to the ...
0
votes
0
answers
47
views
debugging terminates when adding gmp.h library
i appreciate it if you would help me with this problem which i am struggling since 2 days.
i am using vs code and c.
i am trying to do some calculation on floating integers with more than 10 digits ...
3
votes
1
answer
55
views
Bash if statement expression evaluates to FALSE but $? is 0, why?
The example below echoes 1, as expected:
test -f /usr/bin
echo "$?" #1
Why does the following example echo 0?
if [[ -f /usr/bin ]]; then
echo "Inside if statement" # This line ...
0
votes
0
answers
20
views
Android application returns to main activity instead of exiting
I created an exit screen for an android application - when the user clicks exit, it is supposed to show the exit screen for 2sec then close the app. This works in android 10 & pixel emulator, but ...
0
votes
0
answers
217
views
How to check the exit code of a Docker container run with the Jenkins Docker pipeline plugin `withRun()` method?
In my Jenkins pipeline, I run a Docker container.
To take advantage of the automatic cleanup (stopping the Docker container), I use the Jenkins Docker plugin pipeline's withRun() method to run the ...
1
vote
0
answers
79
views
subshell command and capturing the exitcode
in python3 i invoke a parent shell with subprocess.run:
output=subprocess.run(['parent.sh', *cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
then i check the returncode:
print("retcode =&...
0
votes
0
answers
30
views
Linux exit 0 command without a newline?
Linux how do you use the exit 0 command without a newline?
I want :
exit 0
$
I have :
exit 0
$
I have tried:
exit -ne 0
echo -ne
exit 0
2
votes
1
answer
81
views
Child script causes main script to exit?
I see very odd behaviour in bash, and Im trying to understand what is happening.
I have a main script:
#!/usr/bin/env bash
set -eu
DEBUG="N"
source child.sh
echo "Returned"
and ...
1
vote
1
answer
300
views
How to get exit code for Docker container that is not running
I need to get the exit code for containers that are in none running state.
I know the container is not running, I get this information from a different source.
Is there a way in Docker's go SDK to get ...
0
votes
0
answers
55
views
How to monitor the creation and exit events of all child processes recursively of a specific process in Linux (centos)
Suppose I specify a process (known process id), how do I monitor the creation and exit events of all recursive child processes of this process, including:
When the child process was created
The exit ...
0
votes
0
answers
234
views
Calling spark-submit in a shell script is masking the exit code for spark-submit
I'm calling spark-submit from inside of a shell script, like so:
spark-submit --class my.App --master yarn --deploy-mode cluster ./Spark_job.jar
Even when the job fails and this the last command in ...
2
votes
1
answer
731
views
Why is my Github Actions job being skipped?
Been trying to figure this out for a couple of days now. I have these jobs in a GitHub Actions workflow:
jobs:
check-for-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout ...
-1
votes
1
answer
68
views
Why does changing the window class name affect the exit code of a Win32 program?
Why does closing the created window result in an exit code of 134 (0x86) in the reproducible code example below?
What I also found, is that changing the const wchar_t CLASS_NAME[] variable results in ...
0
votes
1
answer
324
views
why waitpid is blocked and how can i know last child process's exit-code
int do_fork(int *status)
{
int pid;
int check;
pid = fork();
if (pid > 0)
{
waitpid(pid, status, 0); // Question
}
else if (pid == 0)
{
check = ...
0
votes
0
answers
42
views
Why I am getting exit code: -1073741819 (STATUS_ACCESS_VIOLATION), RUNTIME_ERROR in Code Forces but not in Code Blocks IDE?
The submission link is: https://codeforces.com/contest/263/my
I am very new to programmming and code forces. Please help me.
I don't know what to do.
0
votes
0
answers
173
views
Python PyQt6 exit code -1073740791 (0xC0000409) in PyCharm
I am working on an assignment for a fairly easy python class at my university. I am working on a payroll system with PyQt6. A lot of the code was given to me, so I do not understand it the best and I ...
0
votes
0
answers
63
views
Calling a WinForms VB.NET application from a command line or from a script
I have a VB.NET legacy software. I want to add a feature, where you can just run the application with an execution parameter/command line argument and it will perform some database updates and then ...
0
votes
0
answers
19
views
I wanted to Load interstitial ad on exit pop up when user pressed yes button. But as soon as ad loaded it closes the application
it an exit pop up confirnmation
I wanted to Load interstitial ad on exit pop up when user pressed yes button. But as soon as ad loaded it closes the application
(I wanted to Load interstitial ad on ...
1
vote
2
answers
77
views
If else loop not working in csh shell script
This is sample perl code. abc.pl
my $a=0; my $b=0; my $c=0;
my $sum = $a+$b+$c; $ex = 0;
if($sum == 0){
print "success"; print " $ex \n";
}else{
$ec=1 ; print "Not ...
0
votes
1
answer
69
views
How to capture exit code of a perl script which is called from a shell script
I have this sample perl code, where $a $b $c values can be changed and has exit code $ex. I call this from another shell script, which is affected by abc.pl's exit code. How do I capture just the ...
1
vote
1
answer
698
views
Use exit code in if statement in Jenkins pipeline
Here's my Jenkins pipeline where I'm trying to to run a conditional statement on the basis of previous command's exit code.
pipeline{
agent any
stages{
stage('Test exitcode'){
...
0
votes
1
answer
528
views
Gitlab job failed with exit code2 after execution of owasp zap scanner
Gitlab job are failing with exit code 2 after execution. No error details are appearing in log file only showing ERROR: Job failed: exit code 2.
.gitlab.ci.yml file:
image: docker:latest
services:
- ...
0
votes
1
answer
356
views
Rundeck jobs fail when powershell script hits any error. NonZeroResultCode
Rundeck 4.8.0 community version on Redhat 9 Linux with Windows node.
My Rundeck jobs call powershell (.ps1) scripts on the windows node.
If there are any errors encountered in the script, the Rundeck ...
0
votes
1
answer
100
views
Exit 1 if there any output, otherwise 0
I have the following line on a GitHub Action:
find kubernetes-manifests -regextype egrep -regex '.*ya?ml$' -exec kubeconform "{}" \;
Unfortunately, kubeconform doesn't return 1 or anything ...
0
votes
0
answers
58
views
How to get a program zero exit code with the help of runtime.addShutdownhook?
I have a thread designed to run forever.
But I want to shut down it gracefully when the program receives an int signal.
I try to use runtime.addShutdownHook() to solve it.
This is my code:
import java....
0
votes
1
answer
373
views
Exit script only AFTER running all commands [duplicate]
I would like my shell script to fail, if a specific command fails. BUT in any case, run the entire script. So i thought about using return 1 at the end of the command i want to "catch" and ...
3
votes
1
answer
128
views
how to return exit code from one program to another program in perl
I have perl Code 2, which is called from perl Code1. return value of code 2 determines, if to proceed further with code 1, or exit. How to write this logic.
Code 1:
my $exit = `perl /home/username/...
1
vote
1
answer
39
views
Fixing an exit function with invalid input print statements reoccuring
My code is running pretty smooth. I have some sentence structure I want to add to the game to make it more immersive. I forgot to add an exit to my game. i created an exit and it works, now when i ...
0
votes
2
answers
62
views
Interpret return value of bash function
I would like to interpret the return value of the function a in the parent bash.
I want to use return to stop an intermediate script in the parent bash.
In this case it means, that test2 shouldn't be ...
0
votes
1
answer
174
views
Donchian Channel Stop Loss
In Pine Script I'm coding a Donchian Channel trading system, where you go long on a 20-day high, and go short on a 20-day low.
I'm fine with coding the opening and closing of the positions, but I'm ...