Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in running perl on windows

Status
Not open for further replies.

whn

Programmer
Oct 14, 2007
265
US
I wrote a perl code running on windows (w2k3) through cygwin.

My code construct a cmd and then executing the cmd by calling system(), e.g. system($cmd). What the cmd does is to silently install a piece of software on the host and reboot the host afterwards. No user interaction is required.

Before I execute system() in my perl code, I ran the cmd constructed by my code from DOS prompt. It went very smoothly, i.e. the software is installed and the host is rebooted successfully.

However, when I tried to execute the same cmd through my perl code by calling system(). I always got an error message in a pop-up window --

The title of the error message window is:

cmd.exe - DLL Initialization Failed

The actual error message is:

The application failed to initialize because the window station is shutting down.

Could someone help?
 
BTW, before I post this question here I did some search on google. According to others, the error message window will disappear automatically. but that is not my case.

The error message window on my screen is always there. I have to click the OK button then the host will reboot.

Please help.
 
Is it only the reboot step that causes the dialogue to appear? i.e. is the software installed correctly?

Annihilannic.
 
Yes, Software installed correctly, only the reboot step caused the problem.

The command can be constructed with the reboot flag on or off. So I also tested this way:

Execute the cmd with the reboot flag off by my code using system(). I then manually reboot the host. And everything went smoothly.

And as I said it before, I can also manually execute the cmd with the reboot flag on at the prompt.

But I just can not execute the cmd with the reboot flag on by calling system().

How strange is that?
 
When you run something through system() from Cygwin, doesn't it run under a Cygwin bash shell instead of CMD.EXE?

Assuming that's the case... have you tested running the command from bash instead?

Annihilannic.
 
That's it! That's the problem!!

Thank you, Annihilannic.

I was running my code under cmd.exe, instead of cygwin bash. I thought there was no difference between the two! I don't have much experience on windows.

Now, I just tested my codes again under cygwin bash. Everything went through just as expected.

Thank you so much, Annihilannic!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top