@@ -25,7 +25,7 @@ use super::commands::ShellCommand;
2525use super :: commands:: builtin_commands;
2626
2727bitflags ! {
28- /// Shell options that can be set via `shopt`.
28+ /// Shell options that can be set via `shopt` or `set -o` .
2929 #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
3030 pub struct ShellOptions : u32 {
3131 /// When set, a glob pattern that matches no files expands to nothing
@@ -35,6 +35,9 @@ bitflags! {
3535 /// This is the default for deno_task_shell (differs from bash).
3636 /// When unset, unmatched globs are passed through literally (bash default).
3737 const FAILGLOB = 1 << 1 ;
38+ /// When set, pipeline exit code is the rightmost non-zero exit code.
39+ /// Set via `set -o pipefail`.
40+ const PIPEFAIL = 1 << 2 ;
3841 }
3942}
4043
@@ -79,7 +82,7 @@ pub struct ShellState {
7982 kill_signal : KillSignal ,
8083 process_tracker : ChildProcessTracker ,
8184 tree_exit_code_cell : TreeExitCodeCell ,
82- /// Shell options set via `shopt`.
85+ /// Shell options set via `shopt` or `set -o` .
8386 shell_options : ShellOptions ,
8487}
8588
@@ -163,7 +166,7 @@ impl ShellState {
163166 EnvChange :: Cd ( new_dir) => {
164167 self . set_cwd ( new_dir. clone ( ) ) ;
165168 }
166- EnvChange :: SetShellOption ( option, enabled) => {
169+ EnvChange :: SetOption ( option, enabled) => {
167170 self . set_shell_option ( * option, * enabled) ;
168171 }
169172 }
@@ -262,8 +265,8 @@ pub enum EnvChange {
262265 // `unset ENV_VAR`
263266 UnsetVar ( OsString ) ,
264267 Cd ( PathBuf ) ,
265- // `shopt -s/-u option`
266- SetShellOption ( ShellOptions , bool ) ,
268+ // `shopt -s/-u option` or `set -o option`
269+ SetOption ( ShellOptions , bool ) ,
267270}
268271
269272pub type FutureExecuteResult = LocalBoxFuture < ' static , ExecuteResult > ;
0 commit comments