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