File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
userland/apps/aero_shell/src Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -192,10 +192,19 @@ fn repl(history: &mut Vec<String>) -> Result<(), AeroSyscallError> {
192
192
}
193
193
194
194
_ => {
195
+ let mut args = args. collect :: < Vec < _ > > ( ) ;
196
+
197
+ // If the command ends with an `&`, then we have to run the command in the background.
198
+ let run_background = args. last ( ) . map ( |& e| e == "&" ) . unwrap_or ( false ) ;
199
+
200
+ // Remove the `&` from the arguments array if present.
201
+ if run_background {
202
+ args. pop ( ) ;
203
+ }
204
+
195
205
let child = sys_fork ( ) ?;
196
206
197
207
if child == 0 {
198
- let args = args. collect :: < Vec < _ > > ( ) ;
199
208
let mut argv = Vec :: new ( ) ;
200
209
201
210
argv. push ( cmd) ;
@@ -221,8 +230,8 @@ fn repl(history: &mut Vec<String>) -> Result<(), AeroSyscallError> {
221
230
}
222
231
223
232
sys_exit ( 0 ) ;
224
- } else {
225
- // Wait for the child
233
+ } else if !run_background {
234
+ // We are not running the command in the background, so wait for the child.
226
235
let mut status = 0 ;
227
236
sys_waitpid ( child, & mut status, 0 ) ?;
228
237
You can’t perform that action at this time.
0 commit comments