aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-01 22:27:15 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-01 22:27:15 +1000
commite95effb043c5e082e53db814088190f7152993f2 (patch)
tree1247cd12f5fe758a14896b2b2c47e677f7fc0246 /exec.c
parent7a1a5a6f015f7e6e8b745b3efc1b4281a063d931 (diff)
Readd the terminal flag for jobs, as not all jobs under job control should be given the terminal.
darcs-hash:20060201122715-ac50b-7efc499e8905e9898c214816d0a3468e077c7005.gz
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/exec.c b/exec.c
index bb502a1d..5f293eb9 100644
--- a/exec.c
+++ b/exec.c
@@ -409,13 +409,13 @@ static int setup_child_process( job_t *j, process_t *p )
/* Wait till shell puts os in our own group */
while( getpgrp() != j->pgid )
sleep(0);
-
- /* Wait till shell gives us stdin */
- if ( j->fg )
- {
- while( tcgetpgrp( 0 ) != j->pgid )
- sleep(0);
- }
+ }
+
+ /* Wait till shell gives us stdin */
+ if ( j->terminal && j->fg )
+ {
+ while( tcgetpgrp( 0 ) != j->pgid )
+ sleep(0);
}
res = handle_child_io( j->io, (p==0) );
@@ -624,23 +624,24 @@ static int handle_new_child( job_t *j, process_t *p )
wperror( L"setpgid" );
}
}
-
- if( j->fg )
- {
- if( tcsetpgrp (0, j->pgid) )
- {
- debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
- j->job_id,
- j->command );
- wperror( L"tcsetpgrp" );
- return -1;
- }
- }
}
else
{
j->pgid = getpid();
}
+
+ if( j->terminal && j->fg )
+ {
+ if( tcsetpgrp (0, j->pgid) )
+ {
+ debug( 1, _( L"Could not send job %d ('%ls') to foreground" ),
+ j->job_id,
+ j->command );
+ wperror( L"tcsetpgrp" );
+ return -1;
+ }
+ }
+
return 0;
}