Skip to content

Commit

Permalink
Fix $Home variable, hotfix version (#3429)
Browse files Browse the repository at this point in the history
  • Loading branch information
danbills authored Mar 16, 2018
1 parent 58c552f commit 39223b8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ trait StandardAsyncExecutionActor extends AsyncBackendJobExecutionActor with Sta

lazy val environmentVariables = instantiatedCommand.environmentVariables map { case (k, v) => s"""export $k="$v"""" } mkString("", "\n", "\n")

val home = jobDescriptor.taskCall.callable.homeOverride.map { _ (runtimeEnvironment) }.getOrElse("$HOME")

// The `tee` trickery below is to be able to redirect to known filenames for CWL while also streaming
// stdout and stderr for PAPI to periodically upload to cloud storage.
// https://stackoverflow.com/questions/692000/how-do-i-write-stderr-to-a-file-while-using-tee-with-a-pipe
Expand All @@ -303,7 +305,7 @@ trait StandardAsyncExecutionActor extends AsyncBackendJobExecutionActor with Sta
|chmod 777 "$$tmpDir"
|export _JAVA_OPTIONS=-Djava.io.tmpdir="$$tmpDir"
|export TMPDIR="$$tmpDir"
|export HOME="${instantiatedCommand.home}"
|export HOME="$home"
|(
|cd $cwd
|SCRIPT_PREAMBLE
Expand Down Expand Up @@ -386,11 +388,9 @@ trait StandardAsyncExecutionActor extends AsyncBackendJobExecutionActor with Sta

(adHocFileCreationSideEffectFiles, environmentVariables, stdinRedirect, stdoutOverride, stderrOverride) mapN {
(adHocFiles, env, in, out, err) =>
val homeOverride = jobDescriptor.taskCall.callable.homeOverride map { _.apply(runtimeEnvironment) }
instantiatedCommand.copy(
createdFiles = instantiatedCommand.createdFiles ++ adHocFiles, environmentVariables = env.toMap,
evaluatedStdinRedirection = in, evaluatedStdoutOverride = out, evaluatedStderrOverride = err,
home = homeOverride.getOrElse(instantiatedCommand.home))
evaluatedStdinRedirection = in, evaluatedStdoutOverride = out, evaluatedStderrOverride = err)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
task notroot {
String empty = ""
command {
echo $HOME
echo $HOME ${empty}
}

runtime {
Expand Down
3 changes: 1 addition & 2 deletions wom/src/main/scala/wom/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ final case class InstantiatedCommand(commandString: String,
evaluatedStdoutOverride: Option[String] = None,
evaluatedStderrOverride: Option[String] = None,
preprocessedInputs: List[(LocalName, WomValue)] = List.empty,
valueMappedPreprocessedInputs: List[(LocalName, WomValue)] = List.empty,
home: String = s"$$HOME")
valueMappedPreprocessedInputs: List[(LocalName, WomValue)] = List.empty)

/**
* File created as a side effect of instantiating the command.
Expand Down

0 comments on commit 39223b8

Please sign in to comment.