Jump to content

Application returns 0 before running?


Kevinsyel
 Share

Recommended Posts

Hi All,

I have written some script that scans every folder down from a given directory and determines if any new folders have come into existence. I used it to scan a release server to determine when new revisions of source have been compiled into a stable version. If the script does not detect any new files, it Exits with Exit Code 1 (This is so that Jenkins knows to fail the given job, and not continue to the next job).

When I test the code on my local machine, a Windows 7 unit, Everything works normally and the exit code exits as "1", however when I run it on my windows 8 test system, The application immediately returns 0, and then a few seconds later actually runs (I can verify this is what's happening because of the files it generates, and the logging I create.)

What's even more annoying is that I have other Auto IT applications that work just find on the Windows8 unit, and Exit with whatever ExitCode I give them.

Is there something I may have set in the code that delays it running?

Link to comment
Share on other sites

Kevin, if I remember when I used to develop with Windows many years back, there is actually a file hook that you can trap and listen into. Scanning folders and files takes too much file intensive operations. You don't have to run jobs to scan the file system. Its a waste of resources.

.

Rather, what you want to do is listen in on the file changes and filter out only the directory and files you are interested in. You can keep a running change list and avoid having to clobber the file system every time you want to run a job to dirctory walk. In other words, let the events come to you, rather than you forcing the issue looking for them.

I'll point you to FileSystemWatcher class in the .NET Framework 4.5 for now to study. Have fun.

Link to comment
Share on other sites

StringingLong-

Thanks for the tip. I currently moved the project onto another system and it works properly on that one. I'm currently using this as a band-aid just to get the project up and running again so I can focus on other tasks. I still don't know exactly what's wrong with it. As soon as I get a moment to come up for air, I'll check out FileSystemWatcher, and implement that in a new project to replace my current scanner. Your help is much appreciated.

To all other people viewing this thread who might have encountered the same issue with a script not running on a Windows 8 system, The only current work around I have was stop using the .exe on the offending machine and simply used it on another machine. I have no idea why this one machine stopped running this one program. Sorry

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...