Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ By default:
- The environment is taken from the Docker configuration of `BASE`.
- The user is `(uid 0) (gid 0)` on Linux, `(name ContainerAdministrator)` on Windows.
- The workdir is `/`, `C:/` on Windows.
- The shell is `/bin/bash -c`, `C:\Windows\System32\cmd.exe /S /C` on Windows.
- The shell is `bash -c`, `C:\Windows\System32\cmd.exe /S /C` on Windows.

### Multi-stage builds

Expand Down
2 changes: 1 addition & 1 deletion lib/build.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module Context = struct

let v ?switch ?(env=[]) ?(user=Obuilder_spec.root) ?workdir ?shell ?(secrets=[]) ~log ~src_dir () =
let workdir = Option.value ~default:(if Sys.win32 then {|C:/|} else "/") workdir in
let shell = Option.value ~default:(if Sys.win32 then ["cmd"; "/S"; "/C"] else ["/bin/bash"; "-c"]) shell in
let shell = Option.value ~default:(if Sys.win32 then ["cmd"; "/S"; "/C"] else ["/usr/bin/env"; "bash"; "-c"]) shell in
{ switch; env; src_dir; user; workdir; shell; log; scope = Scope.empty; secrets }

let with_binding name value t =
Expand Down
2 changes: 1 addition & 1 deletion lib/build.mli
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Context : sig
@param env Environment in which to run commands.
@param user Container user to run as.
@param workdir Directory in the container namespace for cwd.
@param shell The command used to run shell commands (default [["/bin/bash"; "-c"]]).
@param shell The command used to run shell commands (default [["/usr/bin/env"; "bash"; "-c"]]).
@param secrets Provided key-value pairs for secrets.
@param log Function to receive log data.
*)
Expand Down
5 changes: 3 additions & 2 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let mock_op ?(result=Lwt_result.return ()) ?(delay_store=Lwt.return_unit) ?cance
Mock_store.delay_store := delay_store;
let cmd =
match config.argv with
| ["/bin/bash"; "-c"; cmd] | ["cmd"; "/S"; "/C"; cmd] -> cmd
| ["/usr/bin/env" ; "bash"; "-c"; cmd] | ["cmd"; "/S"; "/C"; cmd] -> cmd
| x -> Fmt.str "%a" Fmt.(Dump.list string) x
in
Build_log.printf log "%s@." cmd >>= fun () ->
Expand Down Expand Up @@ -715,7 +715,8 @@ let test_copy_bash _switch () =
Os.pread ["cygpath"; "-m"; src_dir] >>= fun src_dir ->
Lwt.return (String.trim bash, String.trim src_dir)
else
Lwt.return ("/bin/bash", src_dir)
Os.pread ["which"; "bash"] >>= fun bash ->
Lwt.return (String.trim bash, src_dir)
end >>= fun (bash, src_dir) ->
let manifest_bash =
Printf.sprintf "exec %s %S %S %d %s %d %s"
Expand Down