packages.chn-bsub: use fixed bash

This commit is contained in:
2026-01-03 16:56:19 +08:00
parent e2556f3a04
commit 9595bed7c0
2 changed files with 7 additions and 4 deletions

View File

@@ -1,10 +1,10 @@
{ stdenv, cmake, pkg-config, ftxui, biu, bsubConfig ? null, lib }: stdenv.mkDerivation { stdenv, cmake, pkg-config, ftxui, biu, bsubConfig ? null, lib, bash }: stdenv.mkDerivation
{ {
name = "chn-bsub"; name = "chn-bsub";
src = ./.; src = ./.;
buildInputs = [ ftxui biu ]; buildInputs = [ ftxui biu ];
nativeBuildInputs = [ cmake pkg-config ]; nativeBuildInputs = [ cmake pkg-config ];
postInstall = "ln -s chn-bsub $out/bin/chn_bsub"; postInstall = "ln -s chn-bsub $out/bin/chn_bsub";
cmakeFlags = lib.optional (bsubConfig != null) [ "-DBSUB_CONFIG=${bsubConfig}" ]; cmakeFlags = [ "-DBSUB_SH=${bash}/bin/sh" ] ++ lib.optionals (bsubConfig != null) [ "-DBSUB_CONFIG=${bsubConfig}" ];
passthru = { inherit bsubConfig; }; passthru = { inherit bsubConfig; };
} }

View File

@@ -8,6 +8,9 @@
# ifndef BSUB_CONFIG # ifndef BSUB_CONFIG
# define BSUB_CONFIG "./bsub.yaml" # define BSUB_CONFIG "./bsub.yaml"
# endif # endif
# ifndef BSUB_SH
# define BSUB_SH "/bin/sh"
# endif
using namespace biu::literals; using namespace biu::literals;
@@ -166,8 +169,8 @@ int main()
// 提交任务 // 提交任务
log.debug("submit command: {}"_f(State.SubmitCommand)); log.debug("submit command: {}"_f(State.SubmitCommand));
// -c 对 \\n 的处理与通常情况下不同,我们需要用 -s 然后将命令通过标准输入传入 // -c 对 \\n 的处理与通常情况下不同,我们需要用 -s 然后将命令通过标准输入传入
biu::exec<{.SearchPath = true, .Stdin = biu::IoType::String}> biu::exec<{.Stdin = biu::IoType::String}>
({.Program = "sh", .Args = { "-s"}, .Stdin = State.SubmitCommand}); ({.Program = BSUB_SH, .Args = { "-s"}, .Stdin = State.SubmitCommand});
break; break;
} }
else if (!State.UserCommand) return EXIT_FAILURE; else if (!State.UserCommand) return EXIT_FAILURE;