Just speaking to the two devs in question now and they both said they are running Win XP 2002 SP3. This could well be an issue to. Damn that's old.

All, I'm not sure the best way to describe this problem, but here goes.

Most of the devs in my team are using Windows boxes. A couple of experiencing the following problem...

When running commands from the command prompt nothing happens. By nothing I mean, the command prompt returns immediately, no error, no nothing. This does not happen every time but on average you need to run the same command about 5 times before it actually 'sticks' and the command executes.

This is compounded by the fact that if the command being executed in turn also calls other commands, these may fail too.

The net effect of this is a very frustrating time trying to run things like cucumber tests from the command line.

Specifically, these guys have been trying to run cucumber tests but I witnessed this when trying to add a new box via Vagrant this morning. Both these things are Ruby based so maybe there is something there.

Anyway, my questions to you are:

With the above information in mind, have you experienced the windows command line not executing commands randomly and if so, how have you fixed it?

Are there any logs I can look at to see why the command line commands may be failing?

  • I have seen this from time to time in powershell (which is cmd really). I had to exit and start a new window so that the commands will execute. Never figured out why. – johnshen64 Apr 23 '12 at 16:50
  • Sometimes, this is caused by several programs attempting to read from the same console... it would be a good idea to check with ProcExp/ProcessHacker/similar tools if there are any strange child processes of cmd.exe. – user1686 Apr 23 '12 at 17:21
  • 1
    Does this happen with every command including dir and launching programs like notepad? Also do you get an error if you try to launch a non-existent program? – sgmoore Apr 23 '12 at 17:22
  • @grawity - I'll have a look using one of those tools. Thanks. – Aaron Chambers Apr 24 '12 at 9:14
  • @sgmoore - I just had a look and notepad seems to open fine each time. It 'seems' to be Ruby based programs as mentioned above - Cucumber and Vagrant. – Aaron Chambers Apr 24 '12 at 9:15

This can be tricky to diagnose.

Are there any logs I can look at to see why the command line commands may be failing?

Short answer is no. The command prompt simply starts the program and it will display an error if it fails to load, but if it loads, it is then up to the individual program to display what it needs. It is not an error for a program to start and close without doing anything or displaying any information.

You can however use Process Monitor (from Sysinternals) which will show you had is happening (ie each file as it is being accessed and registry entries as they are being read. If you compare what happens when the program behaves correctly with what happens when it fails, it may give you a clue of where the program is going wrong.

Since it is just Ruby based programs that exhibit this issue, then the next stage would be to write/get a very simple ruby program (maybe something that just displays a message) that you can use to test the ruby environment.

It is possible that, if you are rapidly running many ruby programs, that the environment is being loaded and unloaded rapidly and perhaps it fails if you attempted to start a process too quickly after finishing the previous one.

But I would suspect that this will also work which would then leave you looking at the actual programs you are trying to run.

If you have the source (and since you mention devs I'm assuming you do), then you need to check your source for code that could possibly fail but which you are assuming will work, ie where you are not checking for successes. I don't know anything about ruby, but I'm assuming that if it is calling other programs it would return a error status if this call fails and this status value may not be checked and or logged.

But usually the best method is to log copious amount of information which you can then use the track the program flow to determine why it works sometimes on not others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.