exit

PHP script continues after closing / stopping page

依然范特西╮ 提交于 2019-11-28 14:30:36
Seems php scripts continue even after closing or stopping a page. for example, if my script is run by /localhost/test.php after I close the page, sometimes it continues to run. I'm pretty sure restarting apache clears it out but is there a better way to terminate the php script after it's started. You could use ignore_user_abort but I think it only applies if you are running PHP as a command line script . When running scripts from browser , in my experience I have realized scripts running even after the browser was closed . I did not go further to check how long they used to run . The scripts

How do I step out of a loop with Ruby Pry?

限于喜欢 提交于 2019-11-28 13:18:15
问题 I'm using Pry with my Rails application. I set binding.pry inside a loop in my model to try and debug a problem. For example: (1..100).each do |i| binding.pry puts i end When I type quit , it goes to the next iteration and stops again. Is there a way to step out of the loop so I don't have to type quit 100 times? Currently the only way I know how to get out of it is to use CTRL + C and restart the application. 回答1: To exit Pry unconditionally, type exit-program Edit from @Nick's comment :

Why does wait() set status to 256 instead of the -1 exit status of the forked process?

穿精又带淫゛_ 提交于 2019-11-28 12:05:10
I'm trying to return an integer value from a child process. However, if I use exit(1) i get 256 as the output. exit(-1) gives 65280 . Is there a way I can get the actual int value that I send from the child process? if(!(pid=fork())) { exit(1); } waitpid(pid,&status,0); printf("%d",status); Edit: Using exit(-1) (which is what I actually want) I am getting 255 as the output for WEXITSTATUS(status). Is it supposed to be unsigned? Have you tried "man waitpid"? The value returned from the waitpid() call is an encoding of the exit value. There are a set of macros that will provide the original exit

Difference between CancellationTokenSource and exit flag for Task loop exit

家住魔仙堡 提交于 2019-11-28 11:09:47
I was wondering if there is any difference between ending loop task with CancellationTokenSource and exit flag CancellationTokenSource: CancellationTokenSource cancellationTokenSource; Task loopTask; void StartLoop() { cancellationTokenSource = new CancellationTokenSource(); loopTask = Task.Factory.StartNew(Loop, TaskCreationOptions.LongRunning); } void Loop() { while (true) { if (cancellationTokenSource.IsCancellationRequested) break; Thread.Yield(); } } void StopLoop() { cancellationTokenSource.Cancel(); loopTask = null; cancellationTokenSource = null; } Exit flag: volatile bool exitLoop;

Signal 11, segmentation fault on iphone App exit

假装没事ソ 提交于 2019-11-28 10:25:28
I have an iphone app. It seems to run fine. When I connect to a provisioned iphone to Xcode and run the App, the console log in the Organizer window, always complains about a Segmentation fault when quitting the app with the home key. Has anyone else seen this, and do you have an idea of what the problem might be? I use a thread to load web pages in the backround, but I stop the thread when exiting. My app does save some persistent information. When I use the build and analyze function I get some 2 potential memory leaks, but in each case I'm allocating an object and keeping it in an array.

What is the correct way to programmatically quit an MFC application?

人走茶凉 提交于 2019-11-28 09:46:42
Using windows MFC C++. I have a third party app that calls a user-defined method in my CWinApp derived class. This method is called after InitInstance(). If there is an error in this method, such that an exception is thrown and caught in a try/catch block, I would like to exit the application from the catch block. What is the canonical and correct way to quit? UPDATE: Serge I believe is right that in InitInstance() returning false is the correct way to quit the application. However, now suppose I want to quit from a CDialog derived class's OnInitDialog() handler, what's the correct way to do

How will _Exit behave in a C++ program?

↘锁芯ラ 提交于 2019-11-28 08:30:43
C99 offers the _Exit function, which exits "immediately", although it does may close file descriptors. Unix/POSIX extends this behavior by mandating the closing of all fd's without flushing (and offers the synonym _exit ). Will these functions call destructors for static objects when called from a C++ program? Does the C++ standard make any guarantees about _Exit ? (Inspired by this question ; I suddenly wondered what happens in the typical fork - exec - _exit idiom in C++.) It simply doesn't exist in standard C++, so there are no guarantees. It is planned for inclusion in C++0x. That

Exiting batch with `EXIT /B X` where X>=1 acts as if command completed successfully when using && or || operators between batch calls

孤人 提交于 2019-11-28 07:33:36
I'm trying to chain a series of .bat files using the EXIT /B X command to return success or failure and && and || for conditional running of the next .bat (e.g. a.bat && b.bat ). Regardless of whether I call EXIT /B 0 or anything else to end a.bat, a.bat && b.bat will call b.bat afterward. My understanding is that EXIT /B 0 should set ERRORLEVEL=0 , which is success, so the && should continue. The counterpoint to this is that calling EXIT /B 1 should set ERRORLEVEL=1 which is failure, so the && should stop. What am I missing here? Trivialized example: For non-batch commands, acting as expected

Android - Confirm app exit with toast

不问归期 提交于 2019-11-28 07:02:31
I'm new to Android development and I want it so when the user presses the back button on the main activity, a toast message appears with a "confirm exit by pressing the back button again" message. How would I do this? This is what I have so far: @Override public void onBackPressed() { // TODO Auto-generated method stub super.onBackPressed(); Toast s = Toast.makeText(getBaseContext(), "Press back again to exit", Toast.LENGTH_LONG); s.show(); wait(); public boolean onBackPressed() { finish(); } } I would just save the time of the backpress and then compare the time of the latest press to the new

exit android application programmatically

孤人 提交于 2019-11-28 06:37:39
I have two activities, the first is a splash activity. I would like to know how to exit the application from the second activity to the homepage. I've used this method it works BUT it takes to the launcher. public void AppExit() { this.finish(); Intent intent = new Intent(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_HOME); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } Sripathi Whenever you wish to exit all open activities, you should press a button which loads the first Activity that runs when your application starts then clear all the other activities,