exit-code

How can I stop a program's execution with python?

和自甴很熟 提交于 2020-01-04 11:02:49
问题 I use a program (on Windows), whose name I won't disclose, that can be opened from the command line without going through any authentication. I'm trying to create some security to prevent others from accessing it this way. I plan on replacing the built-in binary for this program with a batch file with a first line that points to my own authentication system (implemented in python, compiled to .exe with py2exe), and the second line to the command that opens the program. My original plan was to

exit code of function call ignored if stored in local variable

我们两清 提交于 2020-01-04 05:49:33
问题 Below is the sample scenario :- There is a sample function defined that is echoing some text, as well as setting some exit code using return. There is another script that is calling this function. Below is the simplified code :- ~/playground/octagon/bucket/test/sample $ pwd /Users/mogli/playground/octagon/bucket/test/sample ~/playground/octagon/bucket/test/sample $ cat functions.sh myfunc() { echo "This is output $1" return 3 } ~/playground/octagon/bucket/test/sample $ cat example.sh .

Vi is aliased to vim but exit with code 1

强颜欢笑 提交于 2020-01-04 04:15:13
问题 This is a weird return code even I have aliased vi by vim . I really appreciate if anyone could explain me why. Check my commands and results below. which vi returns /usr/bin/vi which vim returns /usr/bin/vim ls -al /usr/bin/vi /usr/bin/vim returns lrwxr-xr-x 1 root wheel 3 Dec 15 03:34 /usr/bin/vi -> vim -rwxr-xr-x 1 root wheel 1745984 Dec 10 18:03 /usr/bin/vim cat ~/.vimrc returns set nocompatible silent! unmap <C-E> vim then :q to quit immediately. Then echo $? returns 0 vi then :q to

What's the equivalent of ExitThread(ExitCode) and GetExitCodeThread in C# & .net?

怎甘沉沦 提交于 2020-01-03 17:23:27
问题 Reading the VS2008 help file I've figured out that the clean way of exiting a thread (in .net) is either by using a return statement (in C#) or letting the thread reach the end of the method. However, I have not found a method or property that would allow me to set the thread's exit code nor a way to retrieve it (as it is done using the Win32 API). Therefore, the question is, how do I do this using C# and .net ? Thank you for your help, John. 回答1: The reason the underlying Win32 thread

Spring batch return custom process exit code

做~自己de王妃 提交于 2020-01-02 09:05:30
问题 I have one jar with several jobs, I want to execute only one job each time and retrieve a custom exit code. For example, I have basic job ( retrieveErrorsJob ) configuration with one step that will read an input XML file and write the data in specific database table. Application class @SpringBootApplication @EnableBatchProcessing @Import(CoreCommonsAppComponent.class) public class Application { private static final Logger logger = LoggerFactory.getLogger(Application.class); private

Issue with Process Exited

好久不见. 提交于 2020-01-02 02:11:38
问题 lets say I have a process with the ID 1234. This process is running before my application runs. I have this code: Process app = Process.GetProcessById(1234); MessageBox.Show(app.MainWindowTitle); app.Exited += this.methodShowsMessageBox; Now, when I compile and run the app, it gets the process and shows the main window title. However when i close process 1234, the app.Exited does nto fire... why is this? And how would i get it to fire? 回答1: Please note that the documentation states that

Test Environment.Exit() in C#

天大地大妈咪最大 提交于 2020-01-01 10:53:06
问题 Is there in C# some kind of equivalent of ExpectedSystemExit in Java? I have an exit in my code and would really like to be able to test it. The only thing I found in C# is a not really nice workaround. Example Code public void CheckRights() { if(!service.UserHasRights()) { Environment.Exit(1); } } Test Code [TestMethod] public void TestCheckRightsWithoutRights() { MyService service = ... service.UserHasRights().Returns(false); ??? } I am using the VS framework for testing (+ NSubstitute for

Powershell fails to return proper exit code

一世执手 提交于 2020-01-01 08:21:21
问题 When executing a Powershell script (in 2.0) using the -File command line switch, and explicitly defining the input parameters in Param, the exit code is always "0" (never fails) instead of properly returning the defined or expected error code. This does not occur when using the explicit parameter definitions and the -Command switch, however for extraneous purposes, I need to keep the -File switch in my scripts. Any assistance with a workaround (that doesn't involve removing the explicit

npm run cmd fails while cmd on command line works

前提是你 提交于 2020-01-01 04:27:06
问题 In my HTTP Status Check project: If I run node_modules/.bin/jshint . I get: $ node_modules/.bin/jshint . test/inAdapters_fileAdapter.js: line 73, col 31, Missing semicolon. 1 error It executes correctly and produces the expected output: 1 error. But if I add that command to package.json and try and run it through npm run then it works and produces the expected output but also follows that with a bunch of errors: $ npm run jshint > http-status-check@0.0.5 jshint /home/guy/source/http-status

PL/SQL: is there an instruction to completely stop the script execution?

左心房为你撑大大i 提交于 2020-01-01 04:25:12
问题 I'm trying to do some checkings on a DB schema at the beginning of a PL/SQL script. If the checkings give unsuccessful results, I want to stop the script, to prevent the next instructions to be executed. I got something like this -- 1st line of PL/SQL script DECLARE SOME_COUNT INTEGER; BEGIN SELECT COUNT(*) INTO SOME_COUNT FROM SOME_TABLE WHERE <SOME_CONDITIONS>; IF (SOME_COUNT > 0) THEN DBMS_OUTPUT.PUT_LINE('Test failed, I don''want the rest of the script' || ' to be executed.'); --EXIT or