antRun.pl revision 809
2N/A#!/usr/bin/perl
2N/A#
2N/A# Licensed to the Apache Software Foundation (ASF) under one or more
2N/A# contributor license agreements. See the NOTICE file distributed with
2N/A# this work for additional information regarding copyright ownership.
2N/A# The ASF licenses this file to You under the Apache License, Version 2.0
2N/A# (the "License"); you may not use this file except in compliance with
2N/A# the License. You may obtain a copy of the License at
2N/A#
2N/A# http://www.apache.org/licenses/LICENSE-2.0
2N/A#
2N/A# Unless required by applicable law or agreed to in writing, software
2N/A# distributed under the License is distributed on an "AS IS" BASIS,
2N/A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2N/A# See the License for the specific language governing permissions and
2N/A# limitations under the License.
2N/A#
2N/A#######################################################################
2N/A#
2N/A# antRun.pl
2N/A#
2N/A# wrapper script for invoking commands on a platform with Perl installed
2N/A# this is akin to antRun.bat, and antRun the SH script
2N/A#
2N/A# created: 2001-10-18
2N/A# author: Jeff Tulley jtulley@novell.com
2N/A#######################################################################
2N/A#be fussy about variables
2N/Ause strict;
2N/A
2N/A#turn warnings on during dev; generates a few spurious uninitialised var access warnings
2N/A#use warnings;
2N/A
2N/A#and set $debug to 1 to turn on trace info (currently unused)
my $debug=1;
#######################################################################
# change drive and directory to "%1"
my $ANT_RUN_CMD = @ARGV[0];
# assign current run command to "%2"
chdir (@ARGV[0]) || die "Can't cd to $ARGV[0]: $!\n";
if ($^O eq "NetWare") {
# There is a bug in Perl 5 on NetWare, where chdir does not
# do anything. On NetWare, the following path-prefixed form should
# always work. (afaict)
$ANT_RUN_CMD .= "/".@ARGV[1];
}
else {
$ANT_RUN_CMD = @ARGV[1];
}
# dispose of the first two arguments, leaving only the command's args.
shift;
shift;
# run the command
my $returnValue = system $ANT_RUN_CMD, @ARGV;
if ($returnValue eq 0) {
exit 0;
}
else {
# only 0 and 1 are widely recognized as exit values
# so change the exit value to 1
exit 1;
}