exit

Python: pygame.QUIT()

≯℡__Kan透↙ 提交于 2019-12-11 03:09:45
问题 Just been messing around with pygame and ran into this error. CODE: import sys import pygame pygame.init() size = width, height = 600, 400 screen = pygame.display.set_mode(size) while 1: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit(); sys.exit(); ERROR: Traceback (most recent call last): File "C:/Users/Mike Stamets/Desktop/Mygame/Pygame practice/ScreenPractice.py", line 12, in <module> pygame.quit(); sys.exit(); SystemExit I was just trying to set a while loop so

C# Console App, slow to exit

瘦欲@ 提交于 2019-12-11 03:03:08
问题 I have a very basic C# console app that connects to a db, executes a query, closes the connection, and exits out of the app. The problem is, the app takes almost 3 seconds to exit. I have displayed the time at each step to see why it is running slowly and it isn't during any of the processing, just when it exits out of the app. Does anyone know how to speed this up? Here is the output: Opening Connection:94ms 26:OK Closing Connection:356ms Closed Connection:357ms Exiting:358ms [Delay of about

How to exit all the calling scripts in bash?

萝らか妹 提交于 2019-12-11 02:28:14
问题 Lets say I have the following scripts a.sh echo in a if test 1 -ne 2; then echo oops exit 1 fi b.sh echo in b ./a.sh echo in b 2 When running b.sh, I want it to exit if a.sh exited. How do I do this? (The current output is in b in a oops in b 2 And that's not what I want) Thanks, Rivka 回答1: check return status of a command, corresponding variable is $? . alternatively, you can short-circuit using command || exit 回答2: echo in b ./a.sh && echo in b 2 This basically checks that the first script

Mark as successful action for builds in Teamcity

佐手、 提交于 2019-12-11 02:25:33
问题 I have a question to all the experienced Teamcity users out there. I would like to exit out of a job based on a particular condition, but I do not want the status of the job as a failure. Is it possible to mark a job as successful even when you exit out of the job with an "exit code 1" or any pointers to achieve the same (exit out of a Teamcity job but mark the job as successful) through an alternative way is greatly appreciated! Thanks! 回答1: You can use TeamCity service messages to update

Get tkinter.tclerror when closing python turtle before it finished it's draw

*爱你&永不变心* 提交于 2019-12-10 23:32:16
问题 I have a python script that draws a koch snowflake. Everything works fine, except if I close the tutle graphics window before the drawing finished I get a long error with this as a final line: tkinter.tclerror: invalid command name ".38006576". I think it's like in java.swing: exit_on_close. Which is not the default. However I haven't found something like this for python turtle. Any suggestions how to avoid this? import turtle import sys import easygui as eg def isNum(s): try: int(s) return

c program fork and wait golang process status

喜夏-厌秋 提交于 2019-12-10 23:29:47
问题 C program: pid = fork(); if (pid == 0) { execv("Golang Process"); } else (pid > 0) { wait(&status); printf("process %d status: %d\n", pid); } Golang Program: func main() { ...... os.Exit(1) } But, output is: process XXX status: 256 if set os.Exit(2), output is: process XXX status: 512 if set os.Exit(3), output is: process XXX status: 768 Why? 回答1: See wait manual: If status is not NULL, wait() and waitpid() store status information in the int to which it points. This integer can be inspected

Get exit code from a java application in batch file

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-10 21:13:35
问题 I'm currently making an effort to create test cases for one of our java applications. In my code, my java application calls a batch file, which in turn starts a separate java process, that returns an error code that I need to consume from the calling java application. I'm doing the following to invoke my batch file: Process process = runTime.exec(new String[]{"cmd.exe","/c",scriptPath}); exitValue = process.waitFor(); The batch file is as follows: @echo off cd %~dp0 java -cp frames

XNA - How to Exit Game from class other than main?

南笙酒味 提交于 2019-12-10 19:27:31
问题 How do you make it so the game can exit but not have the code in the main class, have it in a different class? 回答1: You can create a method: //Inside of game1.cs public void Quit() { this.Exit() } I'm assuming you want to quit the game on a menu component, in which case you will need to pass the instance of game1 to the component, perhaps add it as a parameter in the menu components update method. public void Update(GameTime gameTime, Game1 game) { if(key is pressed) { game.Quit(); } } I'm

How to get the return code of a shell script in lua?

限于喜欢 提交于 2019-12-10 18:13:42
问题 I'm executing a script in lua: os.execute("sh manager/scripts/update_system.sh" .. " " .. f) And I want to get the output of the script( if exit status is 7 returns 7). I tried local output = os.execute("sh manager/scripts/update_system.sh" .. " " .. f) print(output) but it returns some weird numbers like 512 Any idea how to resolve this? 回答1: It seems like the outputs of os.execute are all 256 multiples. Don't ask me why, it must be a bug. So I did this: local exit = os.execute("sh manager

C++ DLL call from C#

二次信任 提交于 2019-12-10 17:54:54
问题 I want to use a C++ DLL from C#. The C++ DLL is win32 console application. I have successfully called it and want to process the data that I have from c++ in c#. The C# application exits, however, after executing the DLL i.e this line: GetArrayFromDLL(); I am new to C# and visual C++. Can someone provide some suggestions? Thanks namespace ConsoleApplication1 { class Program { [DllImport("Lidar_DataCal_CDLL.dll")] public static extern void GetArrayFromDLL(); static void Main(string[] args) {