tb Add & syntax to run commands without blocking/waiting
This commit is contained in:
@ -188,6 +188,17 @@ bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool inter
|
||||
tz_classify(&tz);
|
||||
tz_expandspecial(&tz);
|
||||
|
||||
bool wait = true;
|
||||
|
||||
if (tz.tokens->str[0] == '&') {
|
||||
Token *tk = tz.tokens;
|
||||
LL_REMOVE(tz.tokens, tk);
|
||||
ufree(tk->str);
|
||||
ufree(tk);
|
||||
|
||||
wait = false;
|
||||
}
|
||||
|
||||
Token *cmdtk = tz.tokens;
|
||||
if (cmdtk->type == TOK_CMD) {
|
||||
ok = cmdtk->cmd(cmdtk->next);
|
||||
@ -217,15 +228,17 @@ bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool inter
|
||||
|
||||
proc_run(app);
|
||||
|
||||
while(proc_pollstate(app) != 4) {
|
||||
if (interactive) {
|
||||
int32_t key = dev_cmd(&ps2kbdev, DEV_PS2KBDEV_READCH, (void *)PID, 0, NULL);
|
||||
if (key > 0 && (uint8_t)key == C('S')) {
|
||||
proc_kill(app);
|
||||
goto cleanup;
|
||||
if (wait) {
|
||||
while(proc_pollstate(app) != 4) {
|
||||
if (interactive) {
|
||||
int32_t key = dev_cmd(&ps2kbdev, DEV_PS2KBDEV_READCH, (void *)PID, 0, NULL);
|
||||
if (key > 0 && (uint8_t)key == C('S')) {
|
||||
proc_kill(app);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
schedrelease();
|
||||
}
|
||||
schedrelease();
|
||||
}
|
||||
|
||||
cleanup: {
|
||||
|
||||
Reference in New Issue
Block a user