From 207e97db7a1ccc15c3890f20130565014be93c95 Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sat, 17 Oct 2015 18:04:30 -0700 Subject: [PATCH] Fix DNX Core testing on Windows - avoid `cmd /C dnvm.cmd ...` because `cmd` does not report `.cmd` script exit code correctly - change both `_dnu.shade` and `_k.shade` though `_k.shade` is more-often an issue - @moozzyk reported problem in [discussion](https://github.com/aspnet/Universe/pull/299#discussion-diff-41954492) of PR #299 --- build/_dnu.shade | 14 +++++++++----- build/_k.shade | 12 ++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build/_dnu.shade b/build/_dnu.shade index 1c00ced8e6..57cad3fdf9 100644 --- a/build/_dnu.shade +++ b/build/_dnu.shade @@ -1,19 +1,23 @@ @{/* dnu - Run dnu commands in your project. Executes dnu command. + Run dnu commands in your project. Executes `dnu` command. command='' The `dnu` subcommand to execute. dnvmUse='' - Optional. The DNX framework to use. Suitable for a `dnvm exec` command. + Optional. The DNX framework to use. Suitable for a `dnvm exec` or `dnvm use` command. */} default dnvmUse='' var dnvmPath = '${ Path.Combine(Directory.GetCurrentDirectory(), "packages", "KoreBuild", "build", "dnvm") }' exec program='cmd' commandline='/C dnu ${command}' if='!IsLinux && string.IsNullOrEmpty(dnvmUse)' -exec program='cmd' commandline='/C "${dnvmPath}" exec ${dnvmUse} dnu ${command}' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)' + +var cmdCommand = '/S /C ""${dnvmPath}.cmd" use ${dnvmUse} && dnu ${command}"' +exec program='cmd' commandline='${ cmdCommand }' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)' + exec program='dnu' commandline='${command}' if='IsLinux && string.IsNullOrEmpty(dnvmUse)' -var commandLine = 'bash -c ". \"${dnvmPath}.sh\"; dnvm exec ${dnvmUse} dnu ${command}"' -exec program='/usr/bin/env' commandline='${ commandLine }' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)' + +var envCommand = 'bash -c "source \"${dnvmPath}.sh\" && dnvm use ${dnvmUse} && dnu ${command}"' +exec program='/usr/bin/env' commandline='${ envCommand }' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)' diff --git a/build/_k.shade b/build/_k.shade index 06cc89b70b..f95d5f81c4 100644 --- a/build/_k.shade +++ b/build/_k.shade @@ -8,7 +8,7 @@ command='' dnxDir='' Optional. The directory in which to execute the `dnx` command. dnvmUse='' - Optional. The DNX framework to use. Suitable for a `dnvm run` command. + Optional. The DNX framework to use. Suitable for a `dnvm run` or `dnvm use` command. */} default currentDir = '${Directory.GetCurrentDirectory()}' @@ -18,7 +18,11 @@ default dnvmUse='' var dnvmPath = '${ Path.Combine(Directory.GetCurrentDirectory(), "packages", "KoreBuild", "build", "dnvm") }' exec program='cmd' commandline='/C dnx ${command}' workingdir='${dnxDir}' if='!IsLinux && string.IsNullOrEmpty(dnvmUse)' -exec program='cmd' commandline='/C "${dnvmPath}" run ${dnvmUse} ${command}' workingdir='${dnxDir}' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)' + +var cmdCommand = '/S /C ""${dnvmPath}.cmd" use ${dnvmUse} && dnx ${command}"' +exec program='cmd' commandline='${ cmdCommand }' workingdir='${dnxDir}' if='!IsLinux && !string.IsNullOrEmpty(dnvmUse)' + exec program='dnx' commandline='${command}' workingdir='${dnxDir}' if='IsLinux && string.IsNullOrEmpty(dnvmUse)' -var commandLine = 'bash -c ". \"${dnvmPath}.sh\"; dnvm run ${dnvmUse} ${command}"' -exec program='/usr/bin/env' commandline='${ commandLine }' workingdir='${dnxDir}' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)' + +var envCommand = 'bash -c "source \"${dnvmPath}.sh\" && dnvm use ${dnvmUse} && dnx ${command}"' +exec program='/usr/bin/env' commandline='${ envCommand }' workingdir='${dnxDir}' if='IsLinux && !string.IsNullOrEmpty(dnvmUse)'