Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed Jun 3, 2024
1 parent 8cacb04 commit 4aacb2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ async fn run(

if let Some(command) = args.command {
// Pass through args.
shell.shell_mut().shell_name = args.script_path;
if let Some(script_path) = args.script_path {
shell.shell_mut().shell_name = Some(script_path);
}
shell.shell_mut().positional_parameters = args.script_args;

// Execute the command string.
Expand Down
14 changes: 14 additions & 0 deletions cli/tests/cases/builtins/exec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,17 @@ cases:
stdin: |
exec $0 -c 'echo "In child shell"'
echo "This is never reached"
- name: "exec without -c"
stdin: |
export myvar=value
exec $0 -c 'echo "myvar: ${myvar}"'
- name: "exec -c"
stdin: |
export myvar=value
exec -c $0 -c 'echo "myvar: ${myvar}"'
- name: "exec -a"
stdin: |
exec -a shellname $0 -c 'echo "0: $0"'

0 comments on commit 4aacb2f

Please sign in to comment.