Questions tagged [exit-code]
The exit-code tag has no usage guidance.
34
questions
1
vote
0
answers
268
views
MySQL refuses to start on my Debian 10 server after a botched control panel installation attempt
Context
After two failed control panel installation (tinycp and cloudpanel) attempts and a restart the MySQL service (Community version 8.0.27) is not starting.
When trying to restart the service, it ...
0
votes
0
answers
149
views
Debian: xinit with startx always returns exit code 0
I am starting kiosk mode application (Electron based) with startx in systemd service. I need to stop service when application is exited with specified exit code. The user running service is not in ...
-1
votes
1
answer
707
views
How do I set the exit code of a one line command to 1 if the result if blank?
If have a command, say echo "", and I want the exit code of that to be 1, however if I were to run the command echo "foo" I would want the status code to be 0.
0
votes
1
answer
2k
views
Cmd crashes with exit code 1 after uninstalling anaconda
On Win10 Pro, Cmd crashes with exit code 1 after uninstalling and reinstalling anaconda; since then, I've been unable to access Command Prompt.
As soon as I open cmd, it closes, and opening within ...
2
votes
1
answer
520
views
CMD prompt: %ERRORLEVEL% gets the correct output value from the second run
I have wolframscript installed on my Windows 10 PC.
Running the following commands on the command prompt get me
> where /q wolframscript & echo %ERRORLEVEL%
9009 <<< why didn't I ...
6
votes
2
answers
1k
views
In a bash script, how do I check if "-e" is set? [duplicate]
I use set -e in scripts quite often, but sometimes, it's ok for a script to fail in some of it's commands.
I tried checking if set -e was ON, but couldn't find a way to do it - there's no option (that ...
2
votes
2
answers
817
views
Why does `%errorlevel%` expand to empty string in DOSBox?
Trying to automate some DOSBox scripting for an old program, I wanted to use the exit code usually in errorlevel to control the program flow.
The input is given in a hello_db.bat file:
@echo off
set ...
1
vote
1
answer
452
views
Why do I get this code 139 error (signal 11: SIGSEGV), and what can I do about it?
I've recently upgraded to Mac OS Catalina and my project that I have been working on keeps getting interrupted by this new error before any of the main code runs:
Process finished with exit code ...
1
vote
2
answers
596
views
Exit Code history and best practice
I am finding a bunch of duplicate error codes when dealing with Autodesk installs and uninstalls. For example
3010 ERROR_SUCCESS_REBOOT_REQUIRED
-2147021886 ERROR_SUCCESS_REBOOT_REQUIRED
and
1618 ...
13
votes
2
answers
2k
views
How to exit with an error code from nano?
When using vim for “replying” to some program – typically git – it can be useful to deliberate exit with error, to abort the entire action that opened the window. Like
$ git commit -a
# vim opens, ...
6
votes
1
answer
619
views
Use output of command as exit code
For my Continuous Integration scripts I want to check if the git branch is not in sync with the master branch. Therefore I use
git rev-list --left-right --count master...my-branch-name
It will ...
1
vote
0
answers
199
views
How to get exit code of a subprocess?
So, I have process B. Typically, process B is called and ran entirely with the context of process A. Unfortunately, for some reason, process B has stopped running properly when called by A, but it ...
1
vote
2
answers
6k
views
BASH pipe exit code
I was writing a simple script that checks for a certain keyword in the output of a command. To see if it works, I was checking the command from the bash command line.
$ ls | grep -q foo
$ echo $?
It ...
1
vote
1
answer
8k
views
What does exit status 1 (0x1) mean for a Windows GUI program?
I have recurring occurrences of Internet Explorer (C:\Program Files\Internet Explorer\iexplore.exe) exiting with exit status 1 (0x1) in my Windows Eventlogs (event id 4689).
Whenever I google for the ...
2
votes
1
answer
999
views
why doesn't "echo $?" print the exit code of the command right before it while used in "&&"?
Suppose I have this simple C program that returns 4 to the shell.
int main()
{
return 4;
}
When I run it, then do echo $?, I would get 4, which is expected
$ gcc foo.c && ./a.out
$ echo $?...
-1
votes
2
answers
2k
views
Echo for status codes?
I'm looking for a tool like echo, but for status codes
$ sts 120
$ echo $?
120
I know you can use a sub-shell in a bash-like environment:
$ (exit 120)
$ echo $?
120
but is there a way to do such ...
2
votes
3
answers
7k
views
Exit code 127 in cygwin64
After years without problems, suddenly several programs in my installation of cygwin64 on 64-bit Windows 7 Professional are failing to run, and instead appear to exit immediately with code 127, which ...
3
votes
2
answers
13k
views
What's the exit code for "curl -I" when not HTTP 200?
I want to check what HTTP status code is returned for an HTTP(S) URL. I don't care about content, so I just request head with
curl -I $url
or
curl --head $url
But what's the exit code I should ...
3
votes
1
answer
3k
views
Exit status of commands before last command
On OS X, Linux, and other systems, you can use $? to get the exit code of the last command. Is there any way to exit codes of older commands? Either by saying "give me the exit code of the nth ...
1
vote
0
answers
61
views
Simulating errorlevel
My command takes long to run but I expect that it can finish with error and I want fail fast in the batch loop in this case. How do I produce the error level?
I tried a batch file with exit 1. But, ...
0
votes
1
answer
369
views
Check shell Script copy Status
I have a cron script and i need to adjust it;
Actually some clients are generating in a directory some files, my task is to backup that files to a tape, and i need to make a if then else
cp $files $...
1
vote
3
answers
117
views
How to find files which do not contain their own filename
When using templates to generate files, it's important to include the template's name inside the template. When reading a generated file, it helps you find the template used to generate it.
I want to ...
2
votes
1
answer
4k
views
How do I run multiple scripts within a script, even if one script fails
I have a simple bash script that executes a number of other scripts …
#/bin/bash
…
./update_artifact1.sh $ARTIFACT_VERSION
./update_artifact2.sh $ARTIFACT_VERSION
./update_artifact3.sh $...
10
votes
3
answers
8k
views
How do you use PIPESTATUS, tee and /bin/sh together?
When I run
curl | tee test.txt; echo ${PIPESTATUS[0]}
I correctly see
curl: try 'curl --help' or 'curl --manual' for more information
2
But when I try to run exactly same command using '/bin/sh':
...
1
vote
1
answer
1k
views
trying to install windows hotfix, but getting a negative exit code
I am trying to install windows-8-RT kb2771744 hotfix. I am getting a negative exit code:
-2125124329
I converted that into hex: 7FDBFFE9
I looked around, I am not sure what to make of it.
530
votes
11
answers
293k
views
Can I make cURL fail with an exitCode different than 0 if the HTTP status code is not 200?
I was always assuming that when curl got an HTTP 500 response it was returning an exit code that meant failure (!= 0), but that seems to be not the case.
Is there a way I can I make cURL fail with an ...
1
vote
1
answer
2k
views
Get errorlevel in cmd script calling ssh
ssh -i private_linux_key user@machine "exit 1" || echo %errorlevel%
This always prints 0. How can I get actual error code returned by ssh?
|| somehow detects that there was an error.
9
votes
4
answers
8k
views
Accessing an exit code outside of a su -m $USER -c "<cmd>"
The below command prints "0" or "1" correctly depending on failure or not because i put $? inside the "su" command.
sudo su -m $USER -c "./shutdown.sh &> /dev/null; echo \$?"
However, if i do ...
4
votes
1
answer
4k
views
How do I invert the exit code of a program or pipe within ZSH?
I want to invert the exit code of a piped command sequence: foo | bar within the ZSH. So 0 maps to 1 and 1-128 maps to 0.
4
votes
2
answers
36k
views
exit code 128, what's the reason?
As per definition exit code 128 means 'invalid exit argument'.
But i always get 255 (Exit status out of range) in case argument is invalid like float number.
Is this the proprietary implementation ...
55
votes
2
answers
21k
views
Can I make SSH fail when a port forwarding fails?
If I do a remote port forward, a la -R 3690:localhost:3690 when a binding already exists on the port on the remote host, I get this warning:
Warning: remote port forwarding failed for listen port ...
19
votes
2
answers
15k
views
How to make TaskScheduler fail when the task returns result different from 0
I have a backup task that fails with a non zero result, yet Task Scheduler says that it executed the task correctly.
Is there any way to tell Task Scheduler that the task failed?
150
votes
12
answers
127k
views
Getting ROBOCOPY to return a "proper" exit code?
Is it possible to ask ROBOCOPY to exit with an exit code that indicates success or failure?
I am using ROBOCOPY as part of my TeamCity build configurations, and having to add a step to just silence ...
2
votes
1
answer
4k
views
How to check return status of command invoked from command line in windows?
reg import RegFile.reg
How to check return code of this command ?