I have an application which is compiled in cygwin. The exe crashes once in a while. If exe is run from cygwin terminal a stackdump file is created. If exe is copied to another folder along with cygwin1.dll and the exe crashes, then no stackdump file is created.
I want a stackdump file to be created even if the exe is run not from cygwin terminal.
How can this be achieved?
When you start a cygwin executable from windows, or a command prompt, the CYGWIN environment variable is usually not set. The shortcut or batch file which starts the cygwin terminal sometimes sets this variable. One of the options that can be set by this variable determines what program is called by windows when the application crashes. The /bin/dumper.exe program generates the stackdump you want.
To get around your problem, I always set the CYGWIN variable from the control panel, computer properties, advances system settings, environment variables, user variables. (Win7 - YMMV). E.g. CYGWIN=error_start=d:\cygwin64\bin\dumper.exe
See The CYGWIN Environment variable for more information.
Related
I want to add a c++ program as a terminal app in linux. How to register my app so that it can be run from anywhere in my computer's terminal?
I am using ubuntu.
You can use an environment variable named $PATH that specifies a set of directories where executable programs are located:
Save your binary in an adequate directory such as usr/opt/your-app;
Using the export command, append the above directory to the $PATH environment variable;
Invoke your binary through the terminal.
In my Go program I call os.Getenv("PATH") on Linux (Debian) and I get different results when running the program from within the shell or when double-clicking the executable icon in my file browser or on my desktop.
I have edited my ~/.profile to include the go binary in the PATH like so:
export PATH=$PATH:/usr/local/go/bin
as suggested the Getting Started Go instrutions.
When I run my os.Getenv("PATH") program from the shell it outputs:
/usr/local/bin:/usr/bin:/bin:/usr/local/go/bin
but when I run it by double-clicking the executable file it outputs:
/usr/local/bin:/usr/bin:/bin
This suggests that double-clicking an icon will not initialize the variables with the profile commands. How can I now get the PATH that I want, i.e. including the additional directories, from my Go program?
It depends on what PATH you want.
Your program gets environment variables from the context it was executed from.
You need to modify your PATH variable for your system to "know" about executables provided with the Go release. And you usually don't need 'usr/local/go/bin' PATH when you already have a compiled binary file.
Every time I ran an executable installed in the system it's all fine without any prompt, but recently I configured my vim editor to do c++ coding. Every time I build a program using make through vim and want to run the built executable, a pop up shows that this file is an executable and whether I want to execute it??
How do I turn that thing off so that no prompt will annoy me?
edit:
The prompt appears only when double clicking the file outside the vim editor.
using LXDE desktop on debian.
edit:
I noticed that any executable file double clicked in file manager gets the same pop up.
when launching the app through the desktop panel it is fine.
I don't know what you did when you "configured vim to do c++", but you should simply be able to build either with a make file by running :make or with g++ directory by calling:
:!g++ % -o %< # calls gcc filename.ext -o filename
Then in like manner to run the compiled program:
:!./%< # executes ./filename (w/o extension) and without prompting
Are you on ubuntu? If so, try open preference of the file, find behavior options, choose execute it when open.
I have a question on how to make process work around in C#.
Suppose I write a program or an executable A.exe, which needs to run in another terminal Environment other than cmd. Manually, I could start that terminal, and then locate my A.exe, then execute. But if we want to write program to automatically start that terminal and ran A.exe, how could we do that.
To be more specific, A.exe may need tools or have dependencies provided by the other terminal. That's why we need to open that terminal first, and inside that terminal environment to run A.exe.
Any suggestions on how to write programs or batch to open that terminal and run A.exe in that terminal? Or there is any other way to implement?
Thanks much!
you may just start both the .BAT setting the appropiate environment and then your program in a single .BAT file
CALL ENV.BAT
A.EXE
I have a Perl program that someone else created and I am calling on with CruiseControl. The program calls on Unix Commands using Cygwin. However, everytime that the Perl program calls on a Unix like command with a DOS like address, I get the well known error:
cygwin warning:
MS-DOS style path detected: E:\regression
Preferred POSIX equivalent is: /cygdrive/e/regression
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
I have set both the User Variable AND System Variable CYGWIN to nodosfilewarning. This removes the error when I run the program from the command line, but the error still occurs in CruiseControl when called as an automated process from a batch file. I have called on both the batch file from the Desktop AND Command Line and ran as an administrator. Nothing changes.
Other Notes
For purposes of this problem, I don't have access to the Perl Program
I am trying to go back to Cygwin 1.5.*, but since I am using Server 2008, I am encountering compatibility issues
This is occurring on one of the distributed servers, not the main server running the Webdashboard.
I have read somewhere that this issue may stem from a different user calling on CruiseControl, but the issue should have been solved by setting this as an ENV System variable
Is it possible to modify the registery to set the ENV variables?
Thank you in advance
The way I do it is like this
printf 'export CYGWIN=nodosfilewarning' >> ~/.bash_profile
If CruiseControl is connecting to the server via ssh, reinstall sshd and explicitly include nodosfilewarning when prompted for the CYGWIN environment variable during the install.
Re-installing with modified environment will work but if you don't want to or cannot re-install, an alternative is to change the registry instead of re-installing the service.
See: CYGWIN windows cygrunsrv sshd server and MS-DOS style path detected