Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.3 KiB

  1. @REM -----------------------------------------------------------------
  2. @REM
  3. @REM wrapper.cmd - JeremyD
  4. @REM used by pbuild.cmd to manage async. processes
  5. @REM
  6. @REM Copyright (c) Microsoft Corporation. All rights reserved.
  7. @REM
  8. @REM -----------------------------------------------------------------
  9. @perl -x "%~f0" %*
  10. @goto :EOF
  11. #!perl
  12. use strict;
  13. use lib $ENV{RAZZLETOOLPATH};
  14. use Logmsg;
  15. use File::Basename;
  16. dbgmsg("wrapper args: " . join(', ', @ARGV));
  17. my ($instance, $command, @options) = @ARGV;
  18. my $short_name = basename($command);
  19. my $command_line = join ' ', $command, @options;
  20. my $start_time = time();
  21. if ( $command =~ /\.p[lm]/ ) {
  22. system( "perl $command_line" );
  23. } else {
  24. system( "$command_line" );
  25. }
  26. my $exit_code = $?;
  27. my $elapsed_time = time() - $start_time;
  28. infomsg("TIMING: $short_name took $elapsed_time seconds");
  29. # finally, send the messages needed to finish up the script
  30. my $event_name = "$short_name";
  31. $event_name .= ".$instance";
  32. dbgmsg("wrapper event name: $event_name");
  33. system( "perl \%RazzleToolPath\%\\PostBuildScripts\\cmdevt.pl -ih " .
  34. "$event_name" );
  35. system( "perl \%RazzleToolPath\%\\PostBuildScripts\\cmdevt.pl -is " .
  36. "$event_name" );
  37. if ($exit_code) {
  38. print "\nPossible error, sleeping 30 minutes\n";
  39. sleep 1800;
  40. }