Skip to content

Commit ee134ea

Browse files
committed
fix executable
1 parent 36a408d commit ee134ea

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ object BashWrapper {
201201
val reqMods = generateComputationalRequirements(config)
202202
val parMods = generateParsers(args)
203203
val execMods = config.mainScript match {
204-
case Some(_: Executable) => generateExecutableArgs(args)
204+
// For executables, only pass the 'par' arguments, not 'meta' or 'dep'
205+
case Some(_: Executable) => generateExecutableArgs(argsMetaAndDeps.getOrElse("par", List.empty))
205206
case _ => BashWrapperMods()
206207
}
207208
val depMods = generateDependencies(config)
@@ -916,14 +917,18 @@ object BashWrapper {
916917
// if mainResource is an executable
917918
case Some(e: Executable) =>
918919
// Execute the executable
920+
// For native engine, run directly. For docker, use -c to pass to shell
919921
val runCode = s"""
920-
|# Add context
921-
|VIASH_RUN_CMD+=" -c '${cdToResources}${e.path.get} $$VIASH_EXECUTABLE_ARGS'"
922-
|
923-
|# Run command
924-
|ViashDebug "Running command: $$(echo $$VIASH_RUN_CMD)"
925-
|eval $$VIASH_RUN_CMD &
926-
|wait "$$!"
922+
|# Run executable
923+
|if [[ "$$VIASH_ENGINE_TYPE" == "docker" ]]; then
924+
| VIASH_RUN_CMD+=" -c '${cdToResources}${e.path.get} $$VIASH_EXECUTABLE_ARGS'"
925+
| ViashDebug "Running command: $$(echo $$VIASH_RUN_CMD)"
926+
| eval $$VIASH_RUN_CMD &
927+
| wait "$$!"
928+
|else
929+
| ViashDebug "Running command: ${cdToResources}${e.path.get} $$VIASH_EXECUTABLE_ARGS"
930+
| eval "${cdToResources}${e.path.get} $$VIASH_EXECUTABLE_ARGS"
931+
|fi
927932
|""".stripMargin
928933

929934
BashWrapperMods(

src/test/resources/test_languages/executable/config.vsh.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ __merge__: [../common-runners.yaml]
1919
engines:
2020
- type: native
2121
- type: docker
22-
image: "bash"
22+
image: "bash:4.4"

0 commit comments

Comments
 (0)