Skip to content

Commit 54051fb

Browse files
committed
fix set wd to resources
1 parent 9917e15 commit 54051fb

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

src/main/scala/io/viash/wrapper/BashWrapper.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ object BashWrapper {
245245
|
246246
|# find source folder of this component
247247
|VIASH_META_RESOURCES_DIR=`ViashSourceDir $${BASH_SOURCE[0]}`
248-
|VIASH_META_RESOURCES_DIR_ORIG="$$VIASH_META_RESOURCES_DIR"
249248
|
250249
|# find the root of the built components & dependencies
251250
|VIASH_TARGET_DIR=`ViashFindTargetDir $$VIASH_META_RESOURCES_DIR`
@@ -904,10 +903,7 @@ object BashWrapper {
904903
// check whether the wd needs to be set to the resources dir
905904
val cdToResources =
906905
if (config.set_wd_to_resources_dir) {
907-
s"""
908-
|# Change to resources dir
909-
|cd "$$VIASH_META_RESOURCES_DIR_ORIG"
910-
|""".stripMargin
906+
"cd \"$VIASH_META_RESOURCES_DIR\"; "
911907
} else {
912908
""
913909
}
@@ -921,8 +917,8 @@ object BashWrapper {
921917
// Execute the executable
922918
val runCode = s"""
923919
|# Add context
924-
|VIASH_RUN_CMD+=" -c '${e.path.get} $$VIASH_EXECUTABLE_ARGS'"
925-
|$cdToResources
920+
|VIASH_RUN_CMD+=" -c '${cdToResources}${e.path.get} $$VIASH_EXECUTABLE_ARGS'"
921+
|
926922
|# Run command
927923
|ViashDebug "Running command: $$(echo $$VIASH_RUN_CMD)"
928924
|eval $$VIASH_RUN_CMD &
@@ -1022,8 +1018,8 @@ object BashWrapper {
10221018
// Execute the script
10231019
val runCode = s"""
10241020
|# Add context
1025-
|VIASH_RUN_CMD+=" -c 'VIASH_WORK_PARAMS=\\\"$$VIASH_WORK_DIR/params.json\\\" ${res.command(scriptPath).replace("\"", "\\\"")}'"
1026-
|$cdToResources
1021+
|VIASH_RUN_CMD+=" -c '${cdToResources}VIASH_WORK_PARAMS=\\\"$$VIASH_WORK_DIR/params.json\\\" ${res.command(scriptPath).replace("\"", "\\\"")}'"
1022+
|
10271023
|# Run command
10281024
|ViashDebug "Running command: $$(echo $$VIASH_RUN_CMD)"
10291025
|eval $$VIASH_RUN_CMD &

0 commit comments

Comments
 (0)