You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

antRun.pl 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/perl
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. #######################################################################
  19. #
  20. # antRun.pl
  21. #
  22. # wrapper script for invoking commands on a platform with Perl installed
  23. # this is akin to antRun.bat, and antRun the SH script
  24. #
  25. # created: 2001-10-18
  26. # author: Jeff Tulley jtulley@novell.com
  27. #######################################################################
  28. #be fussy about variables
  29. use strict;
  30. #turn warnings on during dev; generates a few spurious uninitialised var access warnings
  31. #use warnings;
  32. #and set $debug to 1 to turn on trace info (currently unused)
  33. my $debug=1;
  34. #######################################################################
  35. # change drive and directory to "%1"
  36. my $ANT_RUN_CMD = @ARGV[0];
  37. # assign current run command to "%2"
  38. chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n";
  39. if ($^O eq "NetWare") {
  40. # There is a bug in Perl 5 on NetWare, where chdir does not
  41. # do anything. On NetWare, the following path-prefixed form should
  42. # always work. (afaict)
  43. $ANT_RUN_CMD .= "/".@ARGV[1];
  44. }
  45. else {
  46. $ANT_RUN_CMD = @ARGV[1];
  47. }
  48. # dispose of the first two arguments, leaving only the command's args.
  49. shift;
  50. shift;
  51. # run the command
  52. my $returnValue = system $ANT_RUN_CMD, @ARGV;
  53. if ($returnValue eq 0) {
  54. exit 0;
  55. }
  56. else {
  57. # only 0 and 1 are widely recognized as exit values
  58. # so change the exit value to 1
  59. exit 1;
  60. }