aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bdep/new.cli11
-rw-r--r--bdep/new.cxx4
-rwxr-xr-xdoc/cli.sh1
-rw-r--r--tests/new.testscript43
4 files changed, 31 insertions, 28 deletions
diff --git a/bdep/new.cli b/bdep/new.cli
index dbb9a96..4d7c9a9 100644
--- a/bdep/new.cli
+++ b/bdep/new.cli
@@ -490,11 +490,12 @@ namespace bdep
source directory.
The <command> value is interpreted as a whitespace-separated,
- potentially quoted command line consisting of the program optionally
- followed by arguments and redirects. Specifically, a single level of
- quotes (either single or double) is removed and whitespaces are not
- treated as separators inside such quoted fragments. Currently only the
- \cb{stdout} redirect to a file is supported. For example:
+ potentially quoted command line consisting of a program or a portable
+ \l{testscript#builtins builtin} optionally followed by arguments and
+ redirects. Specifically, a single level of quotes (either single or
+ double) is removed and whitespaces are not treated as separators inside
+ such quoted fragments. Currently only the \cb{stdout} redirect to a
+ file is supported. For example:
\
$ bdep new --post-hook \"echo '.idea/ # IDE' >>.gitignore\" hello
diff --git a/bdep/new.cxx b/bdep/new.cxx
index 681cc18..23bc4bc 100644
--- a/bdep/new.cxx
+++ b/bdep/new.cxx
@@ -661,7 +661,9 @@ namespace bdep
fail << "unable to execute " << what << " hook '" << cmd << "': "
<< e;
}
- catch (const process_error& e)
+ // Also handles process_error exception (derived from system_error).
+ //
+ catch (const system_error& e)
{
fail << "unable to execute " << what << " hook '" << cmd << "': "
<< e;
diff --git a/doc/cli.sh b/doc/cli.sh
index a41721a..5318eb0 100755
--- a/doc/cli.sh
+++ b/doc/cli.sh
@@ -40,6 +40,7 @@ function compile ()
--include-base-last "${o[@]}" --generate-html --html-prologue-file \
man-prologue.xhtml --html-epilogue-file man-epilogue.xhtml --html-suffix .xhtml \
--link-regex '%b([-.].+)%../../build2/doc/b$1%' \
+--link-regex '%testscript(#.+)?%../../build2/doc/build2-testscript-manual.xhtml$1%' \
--link-regex '%bpkg([-.].+)%../../bpkg/doc/bpkg$1%' \
--link-regex '%bpkg(#.+)?%../../bpkg/doc/build2-package-manager-manual.xhtml$1%' \
--link-regex '%brep(#.+)?%../../brep/doc/build2-repository-interface-manual.xhtml$1%' \
diff --git a/tests/new.testscript b/tests/new.testscript
index 84f2026..73f4c6c 100644
--- a/tests/new.testscript
+++ b/tests/new.testscript
@@ -706,7 +706,6 @@ status += -d prj
{
: remote-hooks
:
- if $posix
{
$* -t empty prj 2>! &prj/***;
@@ -724,12 +723,12 @@ status += -d prj
CMakeCache.txt
EOI
- $* --package -t lib -d prj libprj <'y' 2>>~%EOE%;
+ $* --package -t lib -d prj libprj <'y' 2>>/~%EOE%;
%remote hook commands in .+/.build2/bdep-new-package.options:%
pre: mv .gitignore .gitignore.bak
post: cat .gitignore.bak >>.gitignore
post: rm .gitignore.bak
- %execute\? \[y/n\] created new library package libprj in .+/prj/libprj/%
+ %execute\? \[y.n\] created new library package libprj in .+/prj/libprj/%
EOE
cat prj/libprj/.gitignore >>~%EOO%;
@@ -767,7 +766,6 @@ status += -d prj
: post-hook
:
- if $posix
{
: success
:
@@ -776,7 +774,7 @@ status += -d prj
--post-hook "echo .idea/ >>.gitignore" \
--post-hook "echo @mode@ @name@ @base@ @stem@" \
--post-hook "echo @type@ @lang@ @vcs@ @root@" \
- >>"EOO" 2>>/"EOE" &prj/***;
+ >>/"EOO" 2>>/"EOE" &prj/***;
project prj prj prj
empty c++ git $~/prj
EOO
@@ -791,7 +789,7 @@ status += -d prj
$* --package prj -d prj \
--post-hook "echo @@@@TODO >>NEWS" \
--post-hook "echo @mode@ @name@ @base@ @stem@ @root@" \
- >>"EOO" 2>>/"EOE" &prj/prj/***;
+ >>/"EOO" 2>>/"EOE" &prj/prj/***;
package prj prj prj $~/prj
EOO
created new executable package prj in $~/prj/prj/
@@ -802,7 +800,7 @@ status += -d prj
$* --package -t lib libprj.bash -d prj \
--post-hook "echo @@@@TODO >>NEWS" \
--post-hook "echo @mode@ @name@ @base@ @stem@ @root@" \
- >>"EOO" 2>>/"EOE" &prj/prj/***;
+ >>/"EOO" 2>>/"EOE" &prj/prj/***;
package libprj.bash libprj prj $~/prj
EOO
created new library package libprj.bash in $~/prj/libprj.bash/
@@ -810,21 +808,23 @@ status += -d prj
cat prj/libprj.bash/NEWS >'@@TODO';
- cat <<EOI >=hook;
- #!/bin/sh
- echo "$(pwd)"
- echo "$BDEP_NEW_MODE $BDEP_NEW_ROOT"
- EOI
+ if $posix
+ cat <<EOI >=hook
+ #!/bin/sh
+ echo "$(pwd)"
+ echo "$BDEP_NEW_MODE $BDEP_NEW_ROOT"
+ EOI
- chmod u+x hook;
+ chmod u+x hook
- $* -t lib --subdirectory libprj -d prj/prj --post-hook "'$~/hook'" \
- >>"EOO" 2>>/"EOE" &prj/prj/libprj/***
- $~/prj/prj/libprj
- subdirectory $~/prj/prj
- EOO
- created new library source subdirectory libprj in $~/prj/prj/libprj/
- EOE
+ $* -t lib --subdirectory libprj -d prj/prj --post-hook "'$~/hook'" \
+ >>"EOO" 2>>/"EOE" &prj/prj/libprj/***
+ $~/prj/prj/libprj
+ subdirectory $~/prj/prj
+ EOO
+ created new library source subdirectory libprj in $~/prj/prj/libprj/
+ EOE
+ end
}
: failure
@@ -838,7 +838,7 @@ status += -d prj
: open-redirect
:
- $* prj --post-hook 'echo foo >>bar/baz' 2>>/~%EOE% &prj/*** != 0
+ $* prj --post-hook 'echo foo >>bar/baz' 2>>~%EOE% &prj/*** != 0
%error: unable to execute post hook 'echo foo >>bar/baz': unable to open stdout redirect file '.+baz'.*%
EOE
@@ -852,7 +852,6 @@ status += -d prj
: pre-hook
:
- if $posix
{
: success
: