Skip to content

Commit

Permalink
fix: Windows testing broken
Browse files Browse the repository at this point in the history
The jbang.cmd script wasn't handling the creation
of temp files correctly. Also the *nix verion of
the script wasn't properly detecting runing on
Cygwin anymore either. And finally the `build`
command was returning the wrong exit code.

Fixes: quarkusio#421
  • Loading branch information
quintesse authored and maxandersen committed Oct 11, 2020
1 parent dcd2d74 commit 379c3be
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/main/java/dev/jbang/cli/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public Integer doCall() throws IOException {
build(script);
}

return EXIT_EXECUTE;
return EXIT_OK;
}
}
42 changes: 21 additions & 21 deletions src/main/scripts/jbang
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,27 @@ download() {

abs_jbang_path=$(resolve_symlink $(absolute_path $0))

case "$(uname -s)" in
Linux*)
os=linux;;
Darwin*)
os=mac;;
CYGWIN*|MINGW*)
os=windows;;
*) echo "Unsupported Operating System: $(uname -s)" 1>&2; exit 1;;
esac

case "$(uname -m)" in
i?86)
arch=x32;;
x86_64|amd64)
arch=x64;;
aarch64)
arch=aarch64;;
*)
echo "Unsupported Architecture: $(uname -m)" 1>&2; exit 1;;
esac

## when mingw/git bash or cygwin fall out to just running the bat file.
if [[ $os == windows ]]; then
$(dirname $abs_jbang_path)/jbang.cmd $*
Expand Down Expand Up @@ -72,27 +93,6 @@ else
eval "exec $JBDIR/bin/jbang $*"
fi

case "$(uname -s)" in
Linux*)
os=linux;;
Darwin*)
os=mac;;
CYGWIN*|MINGW*)
os=windows;;
*) echo "Unsupported Operating System: $(uname -s)" 1>&2; exit 1;;
esac

case "$(uname -m)" in
i?86)
arch=x32;;
x86_64|amd64)
arch=x64;;
aarch64)
arch=aarch64;;
*)
echo "Unsupported Architecture: $(uname -m)" 1>&2; exit 1;;
esac

# Find/get a JDK
unset JAVA_EXEC
if [[ -n "$JAVA_HOME" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion src/main/scripts/jbang.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ if "!JAVA_EXEC!"=="" (
)
)

set tmpfile=%TDIR%\%RANDOM%.tmp
if not exist "%TDIR%" ( mkdir "%TDIR%" )
set tmpfile=%TDIR%\%RANDOM%.jbang.tmp
rem execute jbang and pipe to temporary random file
set "CMD=!JAVA_EXEC!"
SETLOCAL DISABLEDELAYEDEXPANSION
Expand Down

0 comments on commit 379c3be

Please sign in to comment.